prepare table key matching

conv_bal
watcha.h 2015-03-04 14:42:18 +07:00
parent e203358be3
commit 0bbf685f22
5 changed files with 42 additions and 1 deletions

View File

@ -37,6 +37,14 @@
<tab string="Matching Payment"> <tab string="Matching Payment">
<field name="patient_type_id"/> <field name="patient_type_id"/>
<field name="imp_patient_type_id"/> <field name="imp_patient_type_id"/>
<field name="account_patients" nolabel="1">
<list>
<field name="type_id"/>
<!--<field name="patient_id" domain='[["type_id","=",type_id]]'/>-->
<field name="patient_id"/>
<field name="partner_id" domain='[["is_patient","=","true"]]'/>
</list>
</field>
</tab> </tab>
<tab string="Accounting"> <tab string="Accounting">
<field name="cash_account_id"/> <field name="cash_account_id"/>

View File

@ -2,7 +2,6 @@
<tabs> <tabs>
<tab string="Visit"> <tab string="Visit">
<field name="find_dlz"/> <field name="find_dlz"/>
<button string="Remove Duplicate Visit" type="default" icon="arrow-right" method="remove_douplicate_visit" perm="clinic_setting_rm_dbl_visit"/>
</tab> </tab>
<tab string="HD Case"> <tab string="HD Case">
<group form_layout="stacked"> <group form_layout="stacked">
@ -31,6 +30,7 @@
</tab> </tab>
<tab string="Development"> <tab string="Development">
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/> <button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
<button string="Remove Duplicate Visit" type="default" icon="arrow-right" method="remove_douplicate_visit" perm="clinic_setting_rm_dbl_visit"/>
</tab> </tab>
</tabs> </tabs>
<foot> <foot>

View File

@ -2,6 +2,7 @@ from . import utils
from . import setting from . import setting
from . import setting_product from . import setting_product
from . import setting_account_product from . import setting_account_product
from . import setting_account_patient
from . import setting_shop_product from . import setting_shop_product
from . import setting_level from . import setting_level
from . import setting_policy from . import setting_policy

View File

@ -13,6 +13,7 @@ class ClinicSetting(Model):
'levels': fields.One2Many("clinic.setting.level","setting_id","Levels"), 'levels': fields.One2Many("clinic.setting.level","setting_id","Levels"),
'products': fields.One2Many("clinic.setting.product","setting_id","Products"), 'products': fields.One2Many("clinic.setting.product","setting_id","Products"),
'account_products': fields.One2Many("clinic.setting.account.product","setting_id","Account Products"), 'account_products': fields.One2Many("clinic.setting.account.product","setting_id","Account Products"),
'account_patients': fields.One2Many("clinic.setting.account.patient","setting_id","Account Patients"),
'shop_products': fields.One2Many("clinic.setting.shop.product","setting_id","Shop Products"), 'shop_products': fields.One2Many("clinic.setting.shop.product","setting_id","Shop Products"),
'invoice_policies': fields.One2Many("clinic.setting.policy","setting_id","Invoice Policies"), 'invoice_policies': fields.One2Many("clinic.setting.policy","setting_id","Invoice Policies"),
'cost_per_case': fields.Float("Cost Per Case"), 'cost_per_case': fields.Float("Cost Per Case"),
@ -127,6 +128,21 @@ class ClinicSetting(Model):
print("Only admin!!") print("Only admin!!")
return return
print("Done!") print("Done!")
lines=[]
for pt in get_model("clinic.patient").search_browse([['state','=','admit']]):
partner_id=None
if pt.partner_id:
partner_id=pt.partner_id.id
vals={
'patient_id': pt.id,
'partner_id': partner_id,
'type_id': pt.type_id.id,
}
lines.append(('create',vals))
obj=self.browse(ids)[0]
obj.write({
'account_patients': lines,
})
return return
def update_staff_department(self,ids,context={}): def update_staff_department(self,ids,context={}):

View File

@ -0,0 +1,16 @@
from netforce.model import Model, fields
class SettingAccountPatient(Model):
_name="clinic.setting.account.patient"
_string="Setting Account Patient"
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting",required=True,on_delete="cascade"),
"patient_id": fields.Many2One("clinic.patient","Patient",domain=[["state","=","admit"]]),
'partner_id': fields.Many2One("partner","Contact"),
'type_id': fields.Many2One("clinic.patient.type","Type"),
}
_order="type_id,patient_id"
SettingAccountPatient.register()