minor fix

This commit is contained in:
wilsongomez 2022-03-10 17:32:44 -05:00
parent 718b34ed11
commit 01595a9a3e
1 changed files with 9 additions and 7 deletions

View File

@ -217,7 +217,7 @@ def create_app(dbname):
'code': val['code'],
'category': categories,
# 'sale_price': float(val['template.']['sale_price_w_tax']),
'sale_price': float(val['template.']['list_price']),
'sale_price': float(val['template.']['list_price']) if val['template.'].get('list_price') else 0,
'images': '',
})
return products
@ -274,7 +274,8 @@ def create_app(dbname):
'code': val.code,
'quantity': val.quantity,
'sale_price': float(round(prices2product[template.id], 2)),
'sale_price_w_tax': float(round(template.sale_price_w_tax, 2)),
'sale_price_w_tax': float(round(prices2product[template.id], 2)),
# 'sale_price_w_tax': float(round(template.sale_price_w_tax, 2)),
'attributes': val.attributes,
}
cat = val.template.categories[0]
@ -434,15 +435,16 @@ def create_app(dbname):
])
shops_ = []
for shop in shops:
freight_price = 0
if shop['id'] == 4:
freight_price = 10000
if shop.get('freight_product'):
product_freight_id = shop['freight_product.']['id']
product_freight_price = shop['freight_product.']['temaplate.']['sale_price_w_tax']
new_shop = {
'id': shop['id'],
'name': shop['name'],
'product_freight_id': shop['freight_product.']['id'],
'product_freight_id': product_freight_id,
'product_freight_name': 'FLETE',
'product_freight_price': freight_price,
'product_freight_price': product_freight_price,
}
shops_.append(new_shop)