clinic/netforce_clinic/models/cycle_item_line.py

36 lines
1.1 KiB
Python
Raw Normal View History

2014-10-26 08:48:51 +00:00
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
class CycleItemLine(Model):
_name="clinic.cycle.item.line"
_string="Cycle Item Line"
def all_amount(self,ids,context={}):
res={}
for obj in self.browse(ids):
res[obj.id]={
2014-11-21 02:39:26 +00:00
'amount': (obj.qty or 0)*(obj.rate or 0.0),
2014-10-26 08:48:51 +00:00
}
return res
_fields={
2014-11-21 02:39:26 +00:00
'item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
'level_id': fields.Many2One("clinic.personal.level", "Level",domain=[['type','=','nurse']]),
2014-10-26 08:48:51 +00:00
'qty': fields.Integer("Qty"),
2014-11-21 08:34:30 +00:00
'var_a': fields.Float("A"),
'var_b': fields.Float("B"),
2014-11-21 16:11:57 +00:00
'formular_org': fields.Char("FML1 (Setting)", size=100),
'formular': fields.Char("FML2", size=100),
2014-10-26 08:48:51 +00:00
'rate': fields.Float("Rate"),
2014-11-21 16:11:57 +00:00
'amount': fields.Float("Result",scale=2),
2014-10-26 08:48:51 +00:00
'company_id': fields.Many2One('company','Company'),
2014-11-21 08:34:30 +00:00
"state": fields.Selection([["fail","Fail"],["success","Success"]],"Status",),
2014-10-26 08:48:51 +00:00
}
_defaults={
"company_id": lambda *a: get_active_company(),
}
CycleItemLine.register()