mirror of
https://github.com/bringout/oca-ocb-pos.git
synced 2026-04-23 10:22:06 +02:00
20 lines
534 B
JavaScript
20 lines
534 B
JavaScript
export const addProductLineToOrder = async (
|
|
store,
|
|
order,
|
|
{ templateId = 1, productId = 1, qty = 1, price_unit = 10, ...extraFields } = {}
|
|
) => {
|
|
const template = store.models["product.template"].get(templateId);
|
|
const product = store.models["product.product"].get(productId);
|
|
|
|
const lineData = {
|
|
product_tmpl_id: template,
|
|
product_id: product,
|
|
qty,
|
|
price_unit,
|
|
...extraFields,
|
|
};
|
|
|
|
const line = await store.addLineToOrder(lineData, order);
|
|
|
|
return line;
|
|
};
|