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" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/>
<item string="Schedules" action="clinic_schedule"/>
<divider/>
<header string="OPTIONS"/>
<item string="Races" action="clinic_race"/>

View File

@ -11,14 +11,12 @@
<field name="name"/>
<field name="hn"/>
<field name="reg_date"/>
<field name="job"/>
<field name="gender"/>
<field name="salary"/>
<field name="marital_status"/>
<field name="partner_id"/>
<tabs>
<tab string="General Information">
<group span="6" columns="1">
<field name="gender"/>
<field name="marital_status"/>
<field name="card_type"/>
<field name="card_no"/>
<field name="card_exp"/>
@ -29,6 +27,8 @@
<field name="email"/>
</group>
<group span="6" columns="1">
<field name="job"/>
<field name="salary"/>
<field name="nation_id"/>
<field name="race_id"/>
<field name="grad_id"/>
@ -82,6 +82,9 @@
</list>
</field>
</tab>
<tab string="Schedules">
<field name="schedules"/>
</tab>
</tabs>
<related>
<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,14 +1,21 @@
<form model="clinic.setting" title="Financial Settings">
<separator string="Account Setting Medical Govelopment"/>
<field name="mg_partner_id" />
<field name="ar_mg_id" />
<field name="ap_mg_id" />
<separator string="Account Setting NHSO 30B"/>
<field name="nhso_partner_id" />
<field name="ar_nhso_id" />
<field name="ap_nhso_id" />
<separator string="Account Setting Social Security"/>
<field name="sc_partner_id" />
<field name="ar_sc_id" />
<field name="ap_sc_id" />
<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"/>
<field name="mg_partner_id" />
<field name="ar_mg_id" />
<field name="ap_mg_id" />
<separator string="Account Setting NHSO 30B"/>
<field name="nhso_partner_id" />
<field name="ar_nhso_id" />
<field name="ap_nhso_id" />
<separator string="Account Setting Social Security"/>
<field name="sc_partner_id" />
<field name="ar_sc_id" />
<field name="ap_sc_id" />
</tab>
</tabs>
</form>

View File

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

View File

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

View File

@ -76,6 +76,7 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
'schedules': fields.Many2Many("clinic.schedule","Schedule"),
}
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
monday:
- A, B, C, D
tueday:
========
Account Receivable -> invoice
find account id
1. partner
@ -7,7 +10,8 @@
3. settings
Account Payable -> payment
!!! import
!!! import data
- remove payment
set account payable
issue: