xxxx
parent
719389f5f6
commit
5673bc37f2
|
@ -4,6 +4,7 @@
|
|||
<button string="Options" dropdown="1">
|
||||
<item string="To Draft" method="to_draft" states="confirmed"/>
|
||||
<item string="Recheck Item" method="recheck_item" states="draft"/>
|
||||
<item string="View Cycle Monthly" method="view_cycle_monthly" states="confirmed"/>
|
||||
</button>
|
||||
</head>
|
||||
<tabs>
|
||||
|
|
|
@ -5,20 +5,21 @@
|
|||
<item string="Copy"/>
|
||||
</button>
|
||||
</head>
|
||||
<field name="number"/>
|
||||
<field name="type" required="1"/>
|
||||
<field name="name"/>
|
||||
<field name="name_eng"/>
|
||||
<field name="nick_name"/>
|
||||
<field name="department_id"/>
|
||||
<field name="branch_id"/>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<group span="6" columns="1">
|
||||
<field name="type" required="1"/>
|
||||
<field name="number"/>
|
||||
<field name="name"/>
|
||||
<field name="name_eng"/>
|
||||
<field name="nick_name"/>
|
||||
<field name="identification"/>
|
||||
<field name="expiry_card"/>
|
||||
<field name="gender"/>
|
||||
<field name="birthday"/>
|
||||
<field name="nation_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="categ_id" domain="[['type','=',type]]"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<list model="clinic.staff">
|
||||
<field name="number"/>
|
||||
<field name="name"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="type"/>
|
||||
|
|
|
@ -24,6 +24,7 @@ class CycleDaily(Model):
|
|||
"name": fields.Char("Name"),
|
||||
'date': fields.Date("Date", required=True, search=True),
|
||||
'cycle_items': fields.One2Many("clinic.cycle.item","cycle_daily_id", "Cycle Items"),
|
||||
'cycle_monthly_id': fields.Many2One("clinic.cycle.monthly","Monthly"),
|
||||
'lines': fields.One2Many("clinic.cycle.daily.line","cycle_daily_id", "Lines"),
|
||||
"state": fields.Selection([("draft","Draft"),('confirmed','Confirmed')],"Status",required=True),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
|
@ -50,7 +51,8 @@ class CycleDaily(Model):
|
|||
obj.write({
|
||||
'state': 'confirmed',
|
||||
})
|
||||
# TODO create cycle monthly
|
||||
|
||||
# TODO create/update cycle monthly
|
||||
all_vals={}
|
||||
for line in obj.lines:
|
||||
staff=line.staff_id
|
||||
|
@ -61,6 +63,7 @@ class CycleDaily(Model):
|
|||
all_vals[staff.id]={
|
||||
'level_id': level.id,
|
||||
'type': line.type,
|
||||
'date': obj.date,
|
||||
'qty': 0,
|
||||
'amount': 0,
|
||||
}
|
||||
|
@ -81,7 +84,8 @@ class CycleDaily(Model):
|
|||
mid=res[0]['id']
|
||||
monthly=mobj.browse(mid)
|
||||
for line in monthly.lines:
|
||||
line.delete()
|
||||
if line.date==obj.date:
|
||||
line.delete()
|
||||
monthly.write({
|
||||
'lines': lines,
|
||||
})
|
||||
|
@ -153,4 +157,15 @@ class CycleDaily(Model):
|
|||
data['total']=total
|
||||
return data
|
||||
|
||||
def view_cycle_monthly(self,ids,context):
|
||||
obj=self.browse(ids)[0]
|
||||
monthly=obj.cycle_monthly_id
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_monthly',
|
||||
'mode': 'form',
|
||||
'active_id': monthly.id,
|
||||
},
|
||||
}
|
||||
|
||||
CycleDaily.register()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
|
@ -9,6 +11,7 @@ class CycleMonthlyLine(Model):
|
|||
"cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"),
|
||||
'staff_id': fields.Many2One("clinic.staff", "Staff"),
|
||||
'level_id': fields.Many2One("clinic.staff.level", "Level"),
|
||||
'date': fields.Date("Date"),
|
||||
'qty': fields.Integer("Qty"),
|
||||
'rate': fields.Float("Rate"),
|
||||
'amount': fields.Float("Amount"),
|
||||
|
@ -18,6 +21,7 @@ class CycleMonthlyLine(Model):
|
|||
|
||||
_defaults={
|
||||
'company_id': lambda *a: get_active_company(),
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class Patient(Model):
|
|||
_string="Patient"
|
||||
_audit_log=True
|
||||
_multi_company=True
|
||||
_key=["number,name"]
|
||||
_key=['name']
|
||||
|
||||
def _get_age(self,ids,context):
|
||||
res={}
|
||||
|
|
|
@ -8,7 +8,7 @@ class Staff(Model):
|
|||
_string="Staff"
|
||||
_audit_log=True
|
||||
_multi_company=True
|
||||
_key=["name"]
|
||||
_key=["number","name"]
|
||||
|
||||
def _get_age(self,ids,context={}):
|
||||
res={}
|
||||
|
@ -56,7 +56,7 @@ class Staff(Model):
|
|||
|
||||
_fields={
|
||||
'employee_id': fields.Many2One("hr.employee","Employee"),
|
||||
"number": fields.Char("Ref.",required=True,search=True),
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"name_eng": fields.Char("Eng Name",search=True),
|
||||
"nick_name": fields.Char("Nick Name",search=True),
|
||||
|
@ -98,6 +98,7 @@ class Staff(Model):
|
|||
"rotations": fields.One2Many("clinic.staff.rotation","staff_id","Staff Rotation"),
|
||||
"cycles": fields.One2Many("clinic.staff.cycle","staff_id","Cycles"),
|
||||
'cycle_id': fields.Many2One('clinic.cycle','Last Cycle',function="_get_cycle"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
|
Loading…
Reference in New Issue