clinic/netforce_clinic/models/setting_product.py

34 lines
1.2 KiB
Python

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"),
"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),
'company_id': fields.Many2One("company","Company"),
}
_defaults={
"company_id": lambda *a: get_active_company(),
'qty': 1,
'reimbursable': 'no',
}
_order="patient_type_id"
SettingProduct.register()