from netforce.model import Model, fields from netforce.access import get_active_company class SettingProduct(Model): _name="clinic.setting.product" _string="Setting Product" _multi_company=True _fields={ "setting_id": fields.Many2One("clinic.setting","Setting"), "patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"), 'type_code': fields.Char("Code"), "product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]), 'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"), 'uom_id': fields.Many2One("uom","UOM", required=True), "product_id": fields.Many2One("product","Product"), 'description': fields.Char("Description"), 'price': fields.Float("Price"), 'qty': fields.Integer("Qty"), 'amount': fields.Float("Amount"), "account_id": fields.Many2One("account.account","Account",multi_company=True), "ar_credit_id": fields.Many2One("account.account","AR Credit",multi_company=True), "ar_debit_id": fields.Many2One("account.account","AR Debit",multi_company=True), 'company_id': fields.Many2One("company","Company"), } _defaults={ "company_id": lambda *a: get_active_company(), 'qty': 1, 'reimbursable': 'no', } _order="patient_type_id" SettingProduct.register()