matching payment
parent
77bca62fcc
commit
550a1a58a4
|
@ -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>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<record model="action">
|
||||
<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="view_xml">clinic_make_apt</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<divider/>
|
||||
<header string="OTHERS"/>
|
||||
<item string="Ratchawat Settings" action="clinic_account_setting"/>
|
||||
<item string="Compute Labor Cost" action="clinic_compute_labor_cost"/>
|
||||
</item>
|
||||
</item>
|
||||
<item string="Conversion Balances" position="after">
|
||||
|
|
|
@ -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>
|
|
@ -1,7 +1,11 @@
|
|||
<form model="clinic.matching.payment" attrs='{"readonly":[["state","=","approved"]]}'>
|
||||
<head>
|
||||
<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">
|
||||
<item string="Update Identification" method="update_id"/>
|
||||
<item string="To Draft" method="to_draft" states="approved"/>
|
||||
|
@ -34,6 +38,11 @@
|
|||
</list>
|
||||
</field>
|
||||
<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 span="4" columns="1">
|
||||
<field name="total"/>
|
||||
|
|
|
@ -113,3 +113,4 @@ from . import product
|
|||
from . import base_user
|
||||
from . import select_company
|
||||
from . import name_title
|
||||
from . import compute_labor_cost
|
||||
|
|
|
@ -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()
|
|
@ -513,4 +513,19 @@ class MatchingPayment(Model):
|
|||
super().write(ids,vals,**kw)
|
||||
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()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
todo:
|
||||
|
||||
- compute labor cost
|
||||
- update level
|
||||
|
||||
convbal -> not yet (wait yui) -> ok but have to update memo
|
||||
|
||||
|
|
Loading…
Reference in New Issue