diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml
index b683086..8fc130c 100644
--- a/netforce_clinic/layouts/clinic_setting.xml
+++ b/netforce_clinic/layouts/clinic_setting.xml
@@ -10,10 +10,11 @@
-
+
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 9d4d1b5..9fdcdbd 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -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):
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index 643cf89..02d3038 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -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:
diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py
index 9a542d0..a20b6ec 100644
--- a/netforce_clinic/models/setting.py
+++ b/netforce_clinic/models/setting.py
@@ -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={