From 0ab9af7f3cd501bcc977dbdaf39187c678faacf9 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Wed, 1 Jul 2015 08:13:25 +0700 Subject: [PATCH] get product unit --- netforce_clinic/models/hd_case.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index ada3f76..bc57792 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -1157,10 +1157,23 @@ class HDCase(Model): sub_total=0 amount_total=0 lines=[] + def get_prod(desc): + product=None + if desc: + i1=desc.index('[') + i2=desc.index(']') + code=desc[i1+1:i2] + for prod in get_model("product").search_browse([['code','=',code]]): + product=prod + return product + for line in payment.lines: amt=line.amount or 0 desc=line.description or '' uom_name="" + prod=get_prod(desc) + if prod: + uom_name=prod.uom_id.name lines.append({ 'no': no, 'product_name': '',