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]={
|
|
|
|
'amount': (obj.qty or 0) * (obj.rate or 0.0),
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
|
|
|
|
_fields={
|
|
|
|
'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
|
2014-10-26 15:17:56 +00:00
|
|
|
"type": fields.Selection([("doctor","Doctor"),("nurse","Nurse")],"Personal Type",required=True),
|
|
|
|
'personal_categ': fields.Many2One("clinic.personal.categ", "Nurse Category",),
|
2014-10-26 08:48:51 +00:00
|
|
|
'formular': fields.Char("Formular", size=100),
|
2014-10-26 15:17:56 +00:00
|
|
|
'description': fields.Char("Description"),
|
2014-10-26 08:48:51 +00:00
|
|
|
'qty': fields.Integer("Qty"),
|
|
|
|
'rate': fields.Float("Rate"),
|
2014-10-27 14:17:22 +00:00
|
|
|
#'amount': fields.Float("Amount",function="all_amount", function_multi=True),
|
|
|
|
'amount': fields.Float("Amount"),
|
2014-10-26 08:48:51 +00:00
|
|
|
'company_id': fields.Many2One('company','Company'),
|
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
|
|
|
"company_id": lambda *a: get_active_company(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CycleItemLine.register()
|