minor fix
This commit is contained in:
parent
a69e1dccd4
commit
75253a209a
20
factory.py
20
factory.py
|
@ -259,7 +259,7 @@ def create_app(dbname):
|
|||
('active', '=', True),
|
||||
], order=[('code', 'ASC')]
|
||||
)
|
||||
|
||||
print(values, 'values')
|
||||
# fields_names=[
|
||||
# 'id', 'template.name', 'code', 'template.categories',
|
||||
# 'template.sale_price_w_tax', 'template', 'attributes'
|
||||
|
@ -271,14 +271,18 @@ def create_app(dbname):
|
|||
prices2product = {p['template']: p['list_price'] for p in prices}
|
||||
|
||||
for val in values:
|
||||
if val.components_used:
|
||||
list_price = sum(k.product.list_price for k in val.components_used)
|
||||
else:
|
||||
list_price = float(round(prices2product[template.id], 2))
|
||||
template = val.template
|
||||
product = {
|
||||
'id': val.id,
|
||||
'name': template.name,
|
||||
'code': val.code,
|
||||
'quantity': val.quantity,
|
||||
'sale_price': float(round(prices2product[template.id], 2)),
|
||||
'sale_price_w_tax': float(round(prices2product[template.id], 2)),
|
||||
'sale_price': list_price,
|
||||
'sale_price_w_tax': list_price,
|
||||
# 'sale_price_w_tax': float(round(template.sale_price_w_tax, 2)),
|
||||
'attributes': val.attributes,
|
||||
}
|
||||
|
@ -343,13 +347,17 @@ def create_app(dbname):
|
|||
)
|
||||
prices2product = {p['template']: p['list_price'] for p in prices}
|
||||
for val in values:
|
||||
if val.components_used:
|
||||
list_price = sum(k.product.list_price for k in val.components_used)
|
||||
else:
|
||||
list_price = float(prices2product[val.template.id])
|
||||
add_products({
|
||||
'id': val.id,
|
||||
'name': val.template.name,
|
||||
'code': val.code,
|
||||
'quantity': val.quantity,
|
||||
'sale_price': float(prices2product[val.template.id]),
|
||||
'sale_price_w_tax': float(prices2product[val.template.id]),
|
||||
'sale_price': list_price,
|
||||
'sale_price_w_tax': list_price,
|
||||
'categories': [c.id for c in val.template.categories],
|
||||
})
|
||||
return products
|
||||
|
@ -625,6 +633,8 @@ def create_app(dbname):
|
|||
product = Product(int(l['product']))
|
||||
template = product.template
|
||||
taxes = [tax.id for tax in template.account_category.customer_taxes_used]
|
||||
if product.components_used:
|
||||
l['list_price'] = 0
|
||||
lines.append({
|
||||
'product': int(l['product']),
|
||||
'description': template.name,
|
||||
|
|
Loading…
Reference in New Issue