add option to auto generate hdcase line
parent
078279f07a
commit
117685679e
|
@ -10,10 +10,11 @@
|
||||||
<separator string="Visit"/>
|
<separator string="Visit"/>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
<field name="find_dlz" span="3"/>
|
<field name="find_dlz" span="3"/>
|
||||||
<field name="hdcase_picking_auto" span="3"/>
|
|
||||||
<field name="dlz_picking_auto" span="3"/>
|
<field name="dlz_picking_auto" span="3"/>
|
||||||
</group>
|
</group>
|
||||||
<separator string="HD Case"/>
|
<separator string="HD Case"/>
|
||||||
|
<field name="hdcase_picking_auto" span="3"/>
|
||||||
|
<field name="get_old_expense" span="3"/>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
<!--<field name="waiting_approval" span="3"/>-->
|
<!--<field name="waiting_approval" span="3"/>-->
|
||||||
<!--<field name="real_time" span="3"/>-->
|
<!--<field name="real_time" span="3"/>-->
|
||||||
|
|
|
@ -1448,6 +1448,26 @@ class HDCase(Model):
|
||||||
st=get_model("clinic.setting").browse(1)
|
st=get_model("clinic.setting").browse(1)
|
||||||
if st.auto_gen:
|
if st.auto_gen:
|
||||||
return vals
|
return vals
|
||||||
|
if st.get_old_expense:
|
||||||
|
for hdcase in patient.hd_cases:
|
||||||
|
for line in hdcase.lines:
|
||||||
|
line_vals={
|
||||||
|
'product_categ_id': line.product_categ_id.id,
|
||||||
|
'product_id': line.product_id.id,
|
||||||
|
'description': line.description,
|
||||||
|
'reimbursable': line.reimbursable,
|
||||||
|
'qty': line.qty,
|
||||||
|
'uom_id': line.uom_id.id,
|
||||||
|
'price': line.price,
|
||||||
|
'amount': line.amount,
|
||||||
|
'account_id': line.account_id.id,
|
||||||
|
'ar_debit_id': line.ar_debit_id.id,
|
||||||
|
}
|
||||||
|
vals['lines'].append(('create',line_vals))
|
||||||
|
break
|
||||||
|
if vals['lines']:
|
||||||
|
return vals
|
||||||
|
|
||||||
if not vals.get('lines'):
|
if not vals.get('lines'):
|
||||||
vals['lines']=[]
|
vals['lines']=[]
|
||||||
for st_prod in st.products:
|
for st_prod in st.products:
|
||||||
|
@ -1483,12 +1503,11 @@ class HDCase(Model):
|
||||||
#if not line_vals['account_id']:
|
#if not line_vals['account_id']:
|
||||||
#raise Exception("Please contact accountant: product [%s] %s"%(prod.code, prod.name))
|
#raise Exception("Please contact accountant: product [%s] %s"%(prod.code, prod.name))
|
||||||
vals['lines'].append(('create',line_vals))
|
vals['lines'].append(('create',line_vals))
|
||||||
# XXX need to get default
|
|
||||||
partner=patient.type_id.contact_id
|
partner=patient.type_id.contact_id
|
||||||
if partner:
|
if partner:
|
||||||
vals['fee_partner_id']=partner.id
|
vals['fee_partner_id']=partner.id
|
||||||
if not partner:
|
else:
|
||||||
raise Exception("Not found contact %s at menu: Patiens -> Type"%patient.type_id.name)
|
raise Exception("Missing contact in patiens type %s"%patient.type_id.name)
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
def get_invoice_policy(self,vals={},patient_id=None):
|
def get_invoice_policy(self,vals={},patient_id=None):
|
||||||
|
|
|
@ -314,10 +314,10 @@ class Patient(Model):
|
||||||
'type': 'shipping',
|
'type': 'shipping',
|
||||||
'partner_id': partner_id,
|
'partner_id': partner_id,
|
||||||
'patient_id': obj.id,
|
'patient_id': obj.id,
|
||||||
'address': 'your address',
|
'address': ' ',
|
||||||
'address2': 'your address2',
|
'address2': ' ',
|
||||||
'city': 'your city',
|
'city': ' ',
|
||||||
'postal_code': 'your zip',
|
'postal_code': ' ',
|
||||||
'country_id': 1,
|
'country_id': 1,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -415,7 +415,7 @@ class Patient(Model):
|
||||||
update_visit_pending(obj,visit_vals)
|
update_visit_pending(obj,visit_vals)
|
||||||
# create partner if not found
|
# create partner if not found
|
||||||
partner_id=obj.partner_id
|
partner_id=obj.partner_id
|
||||||
if not partner_id:
|
if not partner_id and not vals.get('partner_id'):
|
||||||
partner_name='%s %s'%(obj.first_name or "", obj.last_name or "") # XXX
|
partner_name='%s %s'%(obj.first_name or "", obj.last_name or "") # XXX
|
||||||
for partner in get_model("partner").search_browse([['name', '=', partner_name]]):
|
for partner in get_model("partner").search_browse([['name', '=', partner_name]]):
|
||||||
if partner.name==obj.name:
|
if partner.name==obj.name:
|
||||||
|
|
|
@ -66,6 +66,7 @@ class ClinicSetting(Model):
|
||||||
'product_categ_view': fields.Many2Many("product.categ","Product Category View"),
|
'product_categ_view': fields.Many2Many("product.categ","Product Category View"),
|
||||||
'hdcase_picking_auto': fields.Boolean("HDCase Auto Picking"),
|
'hdcase_picking_auto': fields.Boolean("HDCase Auto Picking"),
|
||||||
'dlz_picking_auto': fields.Boolean("DLZ Auto Picking"),
|
'dlz_picking_auto': fields.Boolean("DLZ Auto Picking"),
|
||||||
|
'get_old_expense': fields.Boolean("Get old expense"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
|
Loading…
Reference in New Issue