clinic/netforce_clinic/models/hd_case_line.py

39 lines
1.6 KiB
Python
Raw Normal View History

from netforce.model import Model, fields, get_model
2014-08-21 07:29:37 +00:00
class Hdcaseline(Model):
_name="clinic.hd.case.line"
_fields={
2015-01-11 11:23:28 +00:00
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade"),
2015-01-15 05:15:46 +00:00
"hd_case_dis_id": fields.Many2One("clinic.hd.case.popup.discontinue","HD Case",on_delete="cascade"),
2014-10-02 19:12:52 +00:00
"product_id": fields.Many2One("product","Product",search=True),
2014-10-03 02:00:47 +00:00
"description": fields.Char("Description",search=True),
2014-10-02 19:12:52 +00:00
"qty":fields.Integer("QTY"),
"uom_id": fields.Many2One("uom","UOM",required=True,search=True),
"price":fields.Float("Price"),
2014-10-03 02:00:47 +00:00
"amount":fields.Float("Amount"),
2014-12-14 11:15:14 +00:00
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
2014-12-20 18:55:26 +00:00
"product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
2014-12-21 10:11:22 +00:00
'state': fields.Selection([['draft','Draft'],['done','Done']],"State"),
"account_id": fields.Many2One("account.account","Account Credit"),
"ar_debit_id": fields.Many2One("account.account","Account Debit"),
2014-10-22 08:55:57 +00:00
}
2016-02-16 06:33:15 +00:00
def _get_categ(self,context={}):
categ_ids=get_model("product.categ").search([['code','=','EPO']])
if categ_ids:
return categ_ids[0]
else:
return None
2014-10-22 08:55:57 +00:00
_defaults={
2014-11-26 11:22:17 +00:00
'type': 'others',
2014-12-21 02:54:45 +00:00
'reimbursable': 'no',
2014-12-21 10:11:22 +00:00
'state': 'draft',
'product_categ_id': _get_categ,
2014-08-21 07:29:37 +00:00
}
2014-10-02 19:12:52 +00:00
2014-08-21 07:29:37 +00:00
Hdcaseline.register()