Commit e4c07d53 by Damien Moulard

add supplier ref in order line product name

parent e84119f3
......@@ -258,6 +258,11 @@ class Order(models.Model):
}
for line in order_lines:
product_line_name = line["name"]
if line["product_code"] is not False:
product_code = str(line["product_code"])
product_line_name = f"[{product_code}] {product_line_name}"
order_data["order_line"].append(
[
0,
......@@ -267,7 +272,7 @@ class Order(models.Model):
"price_policy": "uom",
"indicative_package": True,
"product_id": line["product_variant_ids"][0],
"name": line["name"],
"name": product_line_name,
"date_planned": date_planned,
"account_analytic_id": False,
"product_qty_package":line["product_qty_package"],
......
......@@ -939,6 +939,7 @@ function create_orders() {
// If a qty is set for a supplier for a product
if ('qty' in p_supplierinfo && p_supplierinfo.qty != 0) {
const supplier_id = p_supplierinfo.supplier_id;
const product_code = p_supplierinfo.product_code;
orders_data.suppliers_data[supplier_id].lines.push({
'package_qty': p_supplierinfo.package_qty,
......@@ -949,7 +950,8 @@ function create_orders() {
'product_uom': p.uom_id[0],
'price_unit': p_supplierinfo.price,
'supplier_taxes_id': p.supplier_taxes_id,
'product_variant_ids': p.product_variant_ids
'product_variant_ids': p.product_variant_ids,
'product_code': product_code
});
}
}
......
......@@ -486,7 +486,7 @@ class CagetteProducts(models.Model):
if supplier_ids is not None and len(supplier_ids) > 0:
# Get products/supplier relation
f = ["product_tmpl_id", 'date_start', 'date_end', 'package_qty', 'price', 'name']
f = ["product_tmpl_id", 'date_start', 'date_end', 'package_qty', 'price', 'name', 'product_code']
c = [['name', 'in', [ int(x) for x in supplier_ids]]]
psi = api.search_read('product.supplierinfo', c, f)
......@@ -543,7 +543,8 @@ class CagetteProducts(models.Model):
filtered_products_t[i]['suppliersinfo'].append({
'supplier_id': int(psi_item["name"][0]),
'package_qty': psi_item["package_qty"],
'price': psi_item["price"]
'price': psi_item["price"],
'product_code': psi_item["product_code"]
})
for s in sales:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment