remain hd case number

conv_bal
watcha.h 2014-11-22 13:08:42 +07:00
parent d229e2eba2
commit 096cbcbb13
1 changed files with 15 additions and 6 deletions

View File

@ -174,7 +174,15 @@ class Visit(Model):
vals['fee_partner_id']=partner_id vals['fee_partner_id']=partner_id
break break
hd_case_id=hd_case_obj.create(vals) # use exist hd_case (in case set to draft)
hd_case_id=None
if obj.hd_cases:
hd_case=obj.hd_cases[0]
hd_case.write(vals)
hd_case_id=hd_case.id
else:
hd_case_id=hd_case_obj.create(vals)
if context.get("called"): #XXX call outside if context.get("called"): #XXX call outside
return hd_case_id return hd_case_id
@ -327,11 +335,12 @@ class Visit(Model):
def to_draft(self,ids,context={}): def to_draft(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
for hd_case in obj.hd_cases: for hd_case in obj.hd_cases:
# XXX hd_case.to_draft()
hd_case.write({ for line in hd_case.lines:
'state': 'draft', line.delete()
}) for ps in hd_case.personals:
hd_case.delete() ps.delete()
#hd_case.delete()
obj.write({ obj.write({
'state': 'draft', 'state': 'draft',
}) })