fix
parent
639522b85d
commit
18bf6dcf86
|
@ -1,4 +1,5 @@
|
|||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class Cycle(Model):
|
||||
_name="clinic.cycle"
|
||||
|
@ -8,11 +9,14 @@ 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"),
|
||||
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'duration': 1,
|
||||
'sequence': 1,
|
||||
'comapany_id': lambda *a: get_active_company(),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,8 +53,7 @@ class HDCase(Model):
|
|||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
|
||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
||||
"comments": fields.One2Many("message","related_id","Comments"),
|
||||
"company_id": fields.Many2One("company","Company"),
|
||||
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
|
||||
"amount": fields.Float("Due Amount",function="get_total",readonly=True,function_multi=True),
|
||||
"total": fields.Float("Total",function="get_total",readonly=True,function_multi=True),
|
||||
"reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True),
|
||||
|
@ -182,7 +181,7 @@ class HDCase(Model):
|
|||
else:
|
||||
total+=amt
|
||||
|
||||
data['total']=total
|
||||
data['total']=total+fee_amt
|
||||
data['fee_amount']=fee_amt
|
||||
for line in data['payment_lines']:
|
||||
total-=line['amount'] or 0.0
|
||||
|
|
|
@ -161,6 +161,19 @@ class Patient(Model):
|
|||
'last_name': obj.name,
|
||||
'type': 'person',
|
||||
})
|
||||
address_id=get_model('address').create({
|
||||
'type': 'shipping',
|
||||
'partner_id': partner_id,
|
||||
'address': 'your address',
|
||||
'address2': 'your address2',
|
||||
'city': 'your city',
|
||||
'postal_code': 'your zip',
|
||||
'country_id': 1, #XXX
|
||||
|
||||
})
|
||||
get_model('address').browse(address_id).write({
|
||||
'related_id': "clinic.patient,%s"%obj.id,
|
||||
})
|
||||
obj.write({
|
||||
'partner_id': partner_id,
|
||||
})
|
||||
|
@ -170,7 +183,9 @@ class Patient(Model):
|
|||
partner_ids=[]
|
||||
for obj in self.browse(ids):
|
||||
partner_ids.append(obj.partner_id.id)
|
||||
address_ids=[addr.id for addr in obj.partner_id.addresses]
|
||||
get_model("partner").delete(partner_ids)
|
||||
get_model("address").delete(address_ids)
|
||||
super().delete(ids)
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
|
|
Loading…
Reference in New Issue