summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-02-26 16:30:42 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-02-26 16:30:42 +0700
commit1c5eaef25d30a2f760afaad4f5329a87cc4da3c1 (patch)
treeaccda243fa6d1ac4777f218a534850a644209927 /indoteknik_api/models
parentc459ff9c8b326929e748bb35b3dffe1cc9248e8a (diff)
<iman> CR repeat order
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/sale_order.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py
index 727379c5..0b9881ec 100644
--- a/indoteknik_api/models/sale_order.py
+++ b/indoteknik_api/models/sale_order.py
@@ -104,11 +104,28 @@ class SaleOrder(models.Model):
data.update(data_with_detail)
else:
data_with_detail = {
+ 'products': [],
'address': {
'customer': res_users.api_address_response(sale_order.partner_id),
}
}
data.update(data_with_detail)
+ for line in sale_order.order_line:
+ product = self.env['product.product'].api_single_response(line.product_id)
+ product['price'] = {
+ 'price': line.price_unit,
+ 'discount_percentage': line.discount,
+ 'price_discount': line.price_reduce_taxexcl,
+ 'subtotal': line.price_subtotal
+ }
+ product['quantity'] = line.product_uom_qty
+ product['available_quantity'] = line.product_available_quantity
+ for data_v2 in sale_order.fulfillment_line_v2:
+ product_v2 = self.env['product.product'].api_single_response(data_v2.product_id)
+ if product['id'] == product_v2['id']:
+ product['so_qty'] = data_v2.so_qty
+ product['reserved_stock_qty'] = data_v2.reserved_stock_qty
+ data_with_detail['products'].append(product)
return data