conv_bal
watcha.h 2014-10-07 20:22:18 +07:00
parent 8ab5d37bea
commit e1240368c0
12 changed files with 102 additions and 26 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Schedule</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.schedule</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -7,6 +7,7 @@
<item string="Patients"> <item string="Patients">
<item string="Patients" action="clinic_patient"/> <item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/> <item string="Dialyzers" action="clinic_dialyzer"/>
<item string="Schedules" action="clinic_schedule"/>
<divider/> <divider/>
<header string="OPTIONS"/> <header string="OPTIONS"/>
<item string="Races" action="clinic_race"/> <item string="Races" action="clinic_race"/>

View File

@ -11,14 +11,12 @@
<field name="name"/> <field name="name"/>
<field name="hn"/> <field name="hn"/>
<field name="reg_date"/> <field name="reg_date"/>
<field name="job"/>
<field name="gender"/>
<field name="salary"/>
<field name="marital_status"/>
<field name="partner_id"/> <field name="partner_id"/>
<tabs> <tabs>
<tab string="General Information"> <tab string="General Information">
<group span="6" columns="1"> <group span="6" columns="1">
<field name="gender"/>
<field name="marital_status"/>
<field name="card_type"/> <field name="card_type"/>
<field name="card_no"/> <field name="card_no"/>
<field name="card_exp"/> <field name="card_exp"/>
@ -29,6 +27,8 @@
<field name="email"/> <field name="email"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<field name="job"/>
<field name="salary"/>
<field name="nation_id"/> <field name="nation_id"/>
<field name="race_id"/> <field name="race_id"/>
<field name="grad_id"/> <field name="grad_id"/>
@ -82,6 +82,9 @@
</list> </list>
</field> </field>
</tab> </tab>
<tab string="Schedules">
<field name="schedules"/>
</tab>
</tabs> </tabs>
<related> <related>
<field name="visits"/> <field name="visits"/>

View File

@ -0,0 +1,4 @@
<form model="clinic.schedule">
<field name="name"/>
<field name="code"/>
</form>

View File

@ -0,0 +1,4 @@
<list model="clinic.schedule">
<field name="name"/>
<field name="code"/>
</list>

View File

@ -1,4 +1,9 @@
<form model="clinic.setting" title="Financial Settings"> <form model="clinic.setting" title="Financial Settings">
<tabs>
<tab string="Schedule">
<button string="Gen Schedule" method="gen_schedule" icon="arrow-right" type="success" />
</tab>
<tab string="Accounting">
<separator string="Account Setting Medical Govelopment"/> <separator string="Account Setting Medical Govelopment"/>
<field name="mg_partner_id" /> <field name="mg_partner_id" />
<field name="ar_mg_id" /> <field name="ar_mg_id" />
@ -11,4 +16,6 @@
<field name="sc_partner_id" /> <field name="sc_partner_id" />
<field name="ar_sc_id" /> <field name="ar_sc_id" />
<field name="ap_sc_id" /> <field name="ap_sc_id" />
</tab>
</tabs>
</form> </form>

View File

@ -6,7 +6,9 @@ from . import graduation
from . import nation from . import nation
from . import race from . import race
from . import cause_chronic from . import cause_chronic
from . import schedule
from . import patient from . import patient
from . import patient_schedule
from . import patient_cause_line from . import patient_cause_line
from . import patient_comorbidity_line from . import patient_comorbidity_line
from . import patient_morbidity_line from . import patient_morbidity_line

View File

@ -36,6 +36,7 @@ class ImportPayment(Model):
'nhso_move_id': fields.Many2One("account.move","Journal Entry"), 'nhso_move_id': fields.Many2One("account.move","Journal Entry"),
"state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail"),('close','Close')],"Status"), "state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail"),('close','Close')],"Status"),
'note': fields.Text("Note"), 'note': fields.Text("Note"),
'partner_id': fields.Many2One("partner","Contact"),
} }
_order="date_import desc" _order="date_import desc"
@ -157,6 +158,7 @@ class ImportPayment(Model):
dom.append(['partner_id','=',partner_id]) dom.append(['partner_id','=',partner_id])
invoice_lines=[] invoice_lines=[]
for invoice in get_model("account.invoice").search_browse(dom): for invoice in get_model("account.invoice").search_browse(dom):
print(invoice)
line={ line={
'invoice_id': invoice.id, 'invoice_id': invoice.id,
'amount': invoice.amount_total, 'amount': invoice.amount_total,
@ -190,12 +192,18 @@ class ImportPayment(Model):
"account_id": account_id, "account_id": account_id,
'lines': [], # TODO find invoice matching 'lines': [], # TODO find invoice matching
} }
#db=get_connection()
if obj.type=='sc': if obj.type=='sc':
if not obj.sc_payment_id: if not obj.sc_payment_id:
payment_id=get_model("account.payment").create(vals,context={'type': 'in'}) payment_id=get_model("account.payment").create(vals,context={'type': 'in'})
obj.write({ obj.write({
'sc_payment_id': payment_id, 'sc_payment_id': payment_id,
}) })
## XX
#sql="update clinic_import_payment set sc_payment_id=%s where id = %s" % (payment_id,obj.id)
#import pdb; pdb.set_trace()
#db.query(sql)
#db.commit()
invoice_lines=obj.find_invoice() invoice_lines=obj.find_invoice()
print("="*30) print("="*30)
for line in invoice_lines: for line in invoice_lines:
@ -204,6 +212,7 @@ class ImportPayment(Model):
# TODO update payment # TODO update payment
# remove invoice, udpate invoice # remove invoice, udpate invoice
if invoice_lines: if invoice_lines:
if obj.sc_payment_id.invoice_lines:
# clear old invoice lines # clear old invoice lines
for line in obj.sc_payment_id.invoice_lines: for line in obj.sc_payment_id.invoice_lines:
line.delete() line.delete()
@ -224,6 +233,7 @@ class ImportPayment(Model):
print("="*30) print("="*30)
if invoice_lines: if invoice_lines:
# clear old invoice lines # clear old invoice lines
if obj.mg_payment_id.invoice_lines:
for line in obj.mg_payment_id.invoice_lines: for line in obj.mg_payment_id.invoice_lines:
line.delete() line.delete()
# update new # update new
@ -239,6 +249,7 @@ class ImportPayment(Model):
invoice_lines=obj.find_invoice() invoice_lines=obj.find_invoice()
if invoice_lines: if invoice_lines:
# clear old invoice lines # clear old invoice lines
if obj.nhso_payment_id.invoice_lines:
for line in obj.nhso_payment_id.invoice_lines: for line in obj.nhso_payment_id.invoice_lines:
line.delete() line.delete()
# update new # update new
@ -404,4 +415,9 @@ class ImportPayment(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
obj.write({'state': 'draft'}) obj.write({'state': 'draft'})
def onchange_type(self,context={}):
data=context['data']
# find partner and set to partner_id
return data
ImportPayment.register() ImportPayment.register()

View File

@ -76,6 +76,7 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"), "partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
'schedules': fields.Many2Many("clinic.schedule","Schedule"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):

View File

@ -0,0 +1,15 @@
import time
from netforce.model import Model, fields
class PatientSchedule(Model):
_name="clinic.patient.schedule"
_string="Patient Schedule"
_fields={
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"),
}
_defaults={
}
PatientSchedule.register()

View File

@ -0,0 +1,13 @@
from netforce.model import Model, fields
class Schedule(Model):
_name="clinic.schedule"
_string="Schedule"
_fields={
'name': fields.Char("Name"),
'code': fields.Char("Code"),
'patients': fields.Many2Many("clinic.patient","Patients"),
}
Schedule.register()

View File

@ -1,5 +1,8 @@
===== todo ===== todo
monday:
- A, B, C, D
tueday:
========
Account Receivable -> invoice Account Receivable -> invoice
find account id find account id
1. partner 1. partner
@ -7,7 +10,8 @@
3. settings 3. settings
Account Payable -> payment Account Payable -> payment
!!! import !!! import data
- remove payment
set account payable set account payable
issue: issue: