matching payment

conv_bal
watcha.h 2015-02-26 07:56:41 +07:00
parent 77bca62fcc
commit 550a1a58a4
9 changed files with 106 additions and 3 deletions

View File

@ -0,0 +1,8 @@
<record model="action">
<field name="name">clinic_compute_labor_cost</field>
<field name="view_cls">form_view</field>
<field name="model">clinic.compute.labor.cost</field>
<field name="view_xml">clinic_compute_labor_cost</field>
<field name="menu">account_menu</field>
</record>

View File

@ -1,6 +1,6 @@
<record model="action"> <record model="action">
<field name="name">clinic_make_apt</field> <field name="name">clinic_make_apt</field>
<field name="view">form_view</field> <field name="view_cls">form_view</field>
<field name="model">clinic.make.apt</field> <field name="model">clinic.make.apt</field>
<field name="view_xml">clinic_make_apt</field> <field name="view_xml">clinic_make_apt</field>
<field name="menu">clinic_menu</field> <field name="menu">clinic_menu</field>

View File

@ -14,6 +14,7 @@
<divider/> <divider/>
<header string="OTHERS"/> <header string="OTHERS"/>
<item string="Ratchawat Settings" action="clinic_account_setting"/> <item string="Ratchawat Settings" action="clinic_account_setting"/>
<item string="Compute Labor Cost" action="clinic_compute_labor_cost"/>
</item> </item>
</item> </item>
<item string="Conversion Balances" position="after"> <item string="Conversion Balances" position="after">

View File

@ -0,0 +1,8 @@
<form model="clinic.compute.labor.cost" title="Compute Labor Cost">
<field name="date" span="2" mode="month" onchange="onchange_date"/>
<field name="date_from" span="2"/>
<field name="date_to" span="2"/>
<foot replace="1">
<button string="Compute" method="compute" icon="repeat" type="default"/>
</foot>
</form>

View File

@ -1,7 +1,11 @@
<form model="clinic.matching.payment" attrs='{"readonly":[["state","=","approved"]]}'> <form model="clinic.matching.payment" attrs='{"readonly":[["state","=","approved"]]}'>
<head> <head>
<field name="state"/> <field name="state"/>
<button string="Print" action="print" icon="print"/> <button string="Print" dropdown="1" icon="print">
<item string="Match" method="print_match"/>
<item string="Unmatch" method="print_unmatch"/>
<item string="Invoice Unmatch" method="print_invoice_unmatch"/>
</button>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="Update Identification" method="update_id"/> <item string="Update Identification" method="update_id"/>
<item string="To Draft" method="to_draft" states="approved"/> <item string="To Draft" method="to_draft" states="approved"/>
@ -34,6 +38,11 @@
</list> </list>
</field> </field>
<group span="8" columns="1"> <group span="8" columns="1">
<field name="total_srv" offset="1" span="3"/>
<newline/>
<field name="total_epo" offset="1" span="3"/>
<newline/>
<field name="total_fee" offset="1" span="3"/>
</group> </group>
<group span="4" columns="1"> <group span="4" columns="1">
<field name="total"/> <field name="total"/>

View File

@ -113,3 +113,4 @@ from . import product
from . import base_user from . import base_user
from . import select_company from . import select_company
from . import name_title from . import name_title
from . import compute_labor_cost

View File

@ -0,0 +1,60 @@
import time
from calendar import monthrange
from netforce.model import Model,fields,get_model
class ComputeLaborCost(Model):
_name="clinic.compute.labor.cost"
_string="Compute Labor Cost"
_transient=True
_fields={
"date": fields.Date("Month"),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
}
def _get_date_from(self,context={}):
year,month=time.strftime("%Y-%m").split("-")
return '%s-%s-01'%(year,month)
def _get_date_to(self,context={}):
year,month,day=time.strftime("%Y-%m-%d").split("-")
weekday, total_day=monthrange(int(year), int(month))
return "%s-%s-%s"%(year,month,total_day)
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date_from': _get_date_from,
'date_to': _get_date_to,
}
def compute(self,ids,context={}):
obj=self.browse(ids)[0]
dom=[]
dom.append(['date','>=', obj.date_from])
dom.append(['date','<=', obj.date_to])
for lcost in get_model("clinic.labor.cost").search_browse(dom):
print("compute %s ....", lcost.cycle_item_id.name)
lcost.compute()
print("Done!")
return {
'next': {
'name': 'clinic_compute_labor_cost',
'mode': 'form',
'active_id': obj.id,
},
'flash': 'Compute Successfully',
}
def onchange_date(self,context={}):
data=context['data']
date=data['date']
year,month,day=date.split("-")
weekday, total_day=monthrange(int(year), int(month))
data['date_from']="%s-%s-01"%(year,month)
data['date_to']="%s-%s-%s"%(year,month,total_day)
return data
ComputeLaborCost.register()

View File

@ -512,5 +512,20 @@ class MatchingPayment(Model):
def write(self,ids,vals,**kw): def write(self,ids,vals,**kw):
super().write(ids,vals,**kw) super().write(ids,vals,**kw)
self.function_store(ids) self.function_store(ids)
def get_data(self,context={}):
data={}
return data
def print_invoice_unmatch(self,ids,context={}):
obj=self.browse(ids)[0]
return {
'next':{
'name': 'clinic_matching_payment',
'mode': 'form',
'active_id': obj.id,
},
'flash': 'TODO',
}
MatchingPayment.register() MatchingPayment.register()

View File

@ -1,5 +1,6 @@
todo: todo:
- compute labor cost
- update level
convbal -> not yet (wait yui) -> ok but have to update memo convbal -> not yet (wait yui) -> ok but have to update memo