pharmacy - sale medecine
parent
44afe08d55
commit
f61aa16d5b
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Pharmacies</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.pharmacy</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -68,13 +68,6 @@
|
|||
</field>
|
||||
</group>
|
||||
<group span="8" form_layout="stacked">
|
||||
<!--
|
||||
<field name="invoice_policy" onchange="onchange_policy"/>
|
||||
<newline/>
|
||||
<group attrs='{"invisible":[["invoice_policy","in",["","fee"]]]}'>
|
||||
<field name="invoice_option"/>
|
||||
</group>
|
||||
-->
|
||||
</group>
|
||||
<group span="4" columns="1">
|
||||
<field name="total_amount"/>
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
</item>
|
||||
<item string="HD Cases" perm="clinic_hdcase">
|
||||
<item string="HD Cases" action="clinic_hd_case"/>
|
||||
<item string="Pharmacies" action="clinic_pharmacy" perm="clinic_pharmacy"/>
|
||||
<divider/>
|
||||
<header string="SETTINGS"/>
|
||||
<item string="Sickbed" action="clinic_sickbed"/>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<form model="clinic.pharmacy">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Copy"/>
|
||||
</button>
|
||||
</head>
|
||||
<group form_layout="stacked">
|
||||
<field name="number" span="2"/>
|
||||
<field name="date" span="2"/>
|
||||
<field name="patient_id" required='1' span="2"/>
|
||||
<field name="ref" span="2"/>
|
||||
<field name="lines" nolabel="1">
|
||||
<list>
|
||||
<field name="product_id" onchange="onchange_product"/>
|
||||
<field name="description"/>
|
||||
<field name="uom_id"/>
|
||||
<field name="qty"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
<group span="9" columns="1">
|
||||
<group form_layout="stacked">
|
||||
<field name="user_id" span="3"/>
|
||||
</group>
|
||||
</group>
|
||||
<group span="3" columns="1">
|
||||
<field name="total"/>
|
||||
</group>
|
||||
<foot>
|
||||
<button string="Pay" type="success"/>
|
||||
</foot>
|
||||
<related>
|
||||
<field name="invoices"/>
|
||||
<field name="payments"/>
|
||||
<field name="pickings"/>
|
||||
</related>
|
||||
</form>
|
|
@ -0,0 +1,7 @@
|
|||
<list model="clinic.pharmacy">
|
||||
<field name="number"/>
|
||||
<field name="date"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
|
@ -85,3 +85,5 @@ from . import product_categ
|
|||
from . import make_apt
|
||||
from . import make_apt_line
|
||||
from . import matching_payment
|
||||
from . import pharmacy
|
||||
from . import pharmacy_line
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_user
|
||||
from netforce.utils import get_data_path
|
||||
|
||||
class Pharmacy(Model):
|
||||
_name="clinic.pharmacy"
|
||||
_string="Pharmacy"
|
||||
|
||||
def _get_all(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
res[obj.id]={
|
||||
'total': 0,
|
||||
}
|
||||
return res
|
||||
|
||||
_fields={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"ref": fields.Char("Ref",search=True),
|
||||
'date': fields.Date("Date",search=True),
|
||||
'patient_id': fields.Many2One('clinic.patient','Patient',search=True),
|
||||
'lines': fields.One2Many('clinic.pharmacy.line','pharmacy_id','Lines'),
|
||||
'total': fields.Float("Total",function="_get_all",function_multi=True),
|
||||
'user_id': fields.Many2One("base.user","Pharmacist"),
|
||||
'state': fields.Selection([['draft','Draft'],['waiting_payment','Waiting Payment'],['paid','Paid']],'State'),
|
||||
"pickings": fields.One2Many("stock.picking","related_id","Pickings"),
|
||||
"invoices": fields.One2Many("account.invoice","related_id","Invoices"),
|
||||
"payments": fields.One2Many("account.payment","related_id","Payments"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'number': '/',
|
||||
'user_id': lambda *a: get_active_user(),
|
||||
'state': 'draft',
|
||||
}
|
||||
|
||||
def onchange_product(self,context={}):
|
||||
data=context['data']
|
||||
path=context['path']
|
||||
line=get_data_path(data,path,parent=True)
|
||||
prod_id=line['product_id']
|
||||
prod=get_model('product').browse(prod_id)
|
||||
line['uom_id']=prod.uom_id.id
|
||||
line['description']=prod.name or ''
|
||||
line['price']=prod.sale_price or 0
|
||||
if not line.get('qty'):
|
||||
line['qty']=1
|
||||
line['amount']=line['price']*line['qty']
|
||||
return data
|
||||
|
||||
Pharmacy.register()
|
|
@ -0,0 +1,18 @@
|
|||
from netforce.model import Model, fields
|
||||
|
||||
class PharmacyLine(Model):
|
||||
_name="clinic.pharmacy.line"
|
||||
_string="Pharmacy Line"
|
||||
|
||||
_fields={
|
||||
'pharmacy_id': fields.Many2One('clinic.pharmacy','Pharmacy',required=True,on_delete="cascade"),
|
||||
'product_id': fields.Many2One('product','Product'),
|
||||
'description': fields.Char("Description"),
|
||||
'uom_id': fields.Many2One("uom","UOM"),
|
||||
'qty': fields.Integer("Qty"),
|
||||
'price': fields.Float("Price"),
|
||||
'amount': fields.Float("Amount"),
|
||||
'account_id': fields.Many2One("account.account","Account"),
|
||||
}
|
||||
|
||||
PharmacyLine.register()
|
|
@ -17,7 +17,7 @@
|
|||
<thead>
|
||||
<th>รอบ</th>
|
||||
<th>#</th>
|
||||
<th>ใบนัดแพทย์</th>
|
||||
<th>ใบนัด</th>
|
||||
<th>HN</th>
|
||||
<th>ผู้ป่วย</th>
|
||||
<!--
|
||||
|
|
|
@ -3,6 +3,8 @@ todo:
|
|||
- doctor labort cost detail ***
|
||||
- matching payment ***
|
||||
- popup messagging
|
||||
- modify message of log
|
||||
- show image of staff
|
||||
=======
|
||||
generate visit ใหม่ -> ok
|
||||
popup select dyalyzer -> ok
|
||||
|
|
Loading…
Reference in New Issue