add field base price for create_sale

This commit is contained in:
Wilson Gomez 2023-10-12 16:50:13 -05:00
parent 277243943c
commit a66265d40e
1 changed files with 6 additions and 4 deletions

10
sale.py
View File

@ -62,6 +62,7 @@ class Sale(metaclass=PoolMeta):
if field_status_order:
line['status_order'] = 'requested'
line['unit'] = template.default_uom.id
line['base_price'] = line['unit_price']
line['description'] = template.name
taxes = list(template.account_category.customer_taxes_used)
taxes_ids = [t.id for t in taxes]
@ -105,12 +106,13 @@ class Sale(metaclass=PoolMeta):
del v['total_amount']
v['type'] = 'line'
v['unit_price'] = round(Decimal(v['unit_price']), 4)
v['base_price'] = round(Decimal(v['unit_price']), 4)
product = Product(v['product'])
if v.get('discount') and v['discount'] != '':
v['discount'] = Decimal(v['discount']) / 100
elif v.get('discount'):
del v['discount']
# if v.get('discount') and v['discount'] != '':
# v['discount'] = Decimal(v['discount']) / 100
# elif v.get('discount'):
# del v['discount']
template = product.template
cls._add_values(template, v, field_status_order)