[hd case] to draft

conv_bal
watcha.h 2014-10-26 11:28:08 +07:00
parent c6e7131b27
commit 7d6240a247
6 changed files with 35 additions and 8 deletions

View File

@ -1,5 +1,16 @@
<form model="clinic.cycle">
<head>
<button string="Options" dropdown="1">
</button>
</head>
<field name="name"/>
<field name="duration"/>
<field name="sequence"/>
<separator string="Labor Cost"/>
<field name="var_k"/>
<field name="var_x"/>
<related>
<field name="visits"/>
<field name="hd_cases"/>
</related>
</form>

View File

@ -2,7 +2,8 @@
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="New Dialyzer" method="new_dialyzer"/>
<item string="New Dialyzer" method="new_dialyzer" states="draft"/>
<item string="To Draft" method="to_draft" states="in_progress"/>
</button>
</head>
<group span="6" columns="1">

View File

@ -16,6 +16,7 @@
<item string="Comorbidities" action="clinic_comorbidity"/>
<item string="Morbidities" action="clinic_morbidity"/>
</item>
<item string="Cycles" action="clinic_cycle"/>
<item string="Visits" action="clinic_visit"/>
<item string="Treatments" action="clinic_hd_case"/>
<item string="Reports">
@ -24,11 +25,11 @@
<item string="HD Summary" action="clinic_report_hd_summary"/>
<header string="HD Madical"/>
<item string="Madical Summary" action="clinic_report_hd_madical"/>
<header string="REPORT SETTINGS"/>
<item string="Translate" action="clinic_translate"/>
</item>
<item string="Settings">
<item string="Cycles" action="clinic_cycle"/>
<item string="Departments" action="clinic_department"/>
<item string="Translate" action="clinic_translate"/>
<item string="Clinic Settings" action="clinic_setting"/>
</item>
</menu>

View File

@ -9,14 +9,18 @@ class Cycle(Model):
"name": fields.Char("Name",required=True,search=True),
'duration': fields.Integer("Duration (hrs)"),
'sequence': fields.Integer("Sequence"),
'comapany_id': fields.Many2One("company", "Company"),
'company_id': fields.Many2One("company", "Company"),
'hd_cases': fields.One2Many("clinic.hd.case","cycle_id", "HD Cases"),
'visits': fields.One2Many("clinic.visit","cycle_id", "Visits"),
'var_k': fields.Float("K"),
'var_x': fields.Float("X"),
}
_defaults={
'duration': 1,
'sequence': 1,
'comapany_id': lambda *a: get_active_company(),
'company_id': lambda *a: get_active_company(),
}

View File

@ -1,9 +1,9 @@
from netforce.model import Model, fields
from netforce.access import get_active_company
class Department(Model):
_name="clinic.department"
_string="Department"
#_name_field="name"
_fields={
"name": fields.Char("Name",required=True,search=True),
@ -11,4 +11,8 @@ class Department(Model):
"parent_id": fields.Many2One("clinic.department", "Parent"),
}
_defaults={
'company_id': lambda *a: get_active_company(),
}
Department.register()

View File

@ -551,11 +551,12 @@ class HDCase(Model):
payment.delete()
for pm_line in obj.payment_lines:
pm_line.delete()
state=context.get("state","in_progress") #force state
obj.write({
'state': 'in_progress',
'state': state,
'fee_paid': False,
})
return {
'next': {
'name': 'clinic_hd_case',
@ -656,5 +657,10 @@ class HDCase(Model):
},
'flash': 'Create new dialyzer successfully',
}
def to_draft(self,ids,context={}):
obj=self.browse(ids)[0]
context['state']='draft'
obj.undo(context=context)
HDCase.register()