get product unit
parent
d31c550e9c
commit
0ab9af7f3c
|
@ -1157,10 +1157,23 @@ class HDCase(Model):
|
||||||
sub_total=0
|
sub_total=0
|
||||||
amount_total=0
|
amount_total=0
|
||||||
lines=[]
|
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:
|
for line in payment.lines:
|
||||||
amt=line.amount or 0
|
amt=line.amount or 0
|
||||||
desc=line.description or ''
|
desc=line.description or ''
|
||||||
uom_name=""
|
uom_name=""
|
||||||
|
prod=get_prod(desc)
|
||||||
|
if prod:
|
||||||
|
uom_name=prod.uom_id.name
|
||||||
lines.append({
|
lines.append({
|
||||||
'no': no,
|
'no': no,
|
||||||
'product_name': '',
|
'product_name': '',
|
||||||
|
|
Loading…
Reference in New Issue