show owner of dlz

production
watcha.h 2015-12-11 13:44:03 +07:00
parent 68a5621d4b
commit 5d1a7ba4f1
2 changed files with 16 additions and 1 deletions

View File

@ -24,6 +24,8 @@
<field name="company_id" invisible="1"/>
</group>
<group span="6" columns="1">
<field name="create_user_id"/>
<field name="write_user_id"/>
</group>
<group span="6" columns="1">
<template>

View File

@ -2,6 +2,7 @@ import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company, get_active_user, set_active_user
from netforce.database import get_connection
class Dialyzer(Model):
_name="clinic.dialyzer"
@ -9,7 +10,17 @@ class Dialyzer(Model):
_audit_log=True
_name_field="number"
_multi_company=True
def _get_user(self,ids,context={}):
res={}
db=get_connection()
for r in db.query("""select id,create_uid, write_uid from clinic_dialyzer where id in %s""",tuple(ids)):
res[r['id']]={
'create_user_id': r['create_uid'],
'write_user_id': r['write_uid'],
}
return res
_fields={
"name": fields.Char("Name",search=True),
"number": fields.Char("Number",required=True,search=True),
@ -32,6 +43,8 @@ class Dialyzer(Model):
"hd_cases_dlz": fields.One2Many("clinic.hd.case.dialyzer","dialyzer_id","Dialyzer History",domain=[['hd_case_id.state','in','waiting_payment','paid']]),
'department_id': fields.Many2One("clinic.department","Department",search=True),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
'write_user_id': fields.Many2One("base.user","Updated By",function="_get_user",function_multi=True),
'create_user_id': fields.Many2One("base.user","Create By",function="_get_user",function_multi=True),
}
def _get_number(self,context={}):