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