xxxx
parent
7326ac9da3
commit
a13cc8797f
|
@ -15,8 +15,8 @@
|
|||
<field name="personal_id"/>
|
||||
<field name="level_id"/>
|
||||
<field name="type"/>
|
||||
<field name="qty"/>
|
||||
<field name="rate"/>
|
||||
<field name="qty" onchange="onchange_line"/>
|
||||
<field name="rate" onchange="onchange_line"/>
|
||||
<field name="amount"/>
|
||||
</list>
|
||||
<form>
|
||||
|
|
|
@ -2,6 +2,7 @@ import time
|
|||
|
||||
from netforce.model import Model, fields
|
||||
from netforce.access import get_active_company, get_active_user
|
||||
from netforce.utils import get_data_path
|
||||
|
||||
class CycleDialy(Model):
|
||||
_name="clinic.cycle.dialy"
|
||||
|
@ -94,4 +95,19 @@ class CycleDialy(Model):
|
|||
'flash':'Draft!',
|
||||
}
|
||||
|
||||
def onchange_line(self,context={}):
|
||||
data=context['data']
|
||||
path=context['path']
|
||||
line=get_data_path(data,path,parent=True)
|
||||
qty=line['qty']
|
||||
rate=line['rate']
|
||||
line['amount']=qty*rate
|
||||
total=0.0
|
||||
for line in data['lines']:
|
||||
qty=line['qty']
|
||||
rate=line['rate']
|
||||
total+=qty*rate
|
||||
data['total']=total
|
||||
return data
|
||||
|
||||
CycleDialy.register()
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue