diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-11-29 03:42:58 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-11-29 03:42:58 +0000 |
| commit | 301ad8d828e5ff43515b9f1ab467c9082fccd6f7 (patch) | |
| tree | 6cc7e014ef006e8d7794f2b6f50437bef61dd724 /indoteknik_api | |
| parent | fa3da08e5c0837e1492a3b00b17b7492c07ac676 (diff) | |
| parent | 75cad0da1476a2e605ef5d0f35cfb58944831934 (diff) | |
Merged in CR/website-improvment (pull request #255)
CR/website improvment
Diffstat (limited to 'indoteknik_api')
| -rw-r--r-- | indoteknik_api/models/product_template.py | 6 | ||||
| -rw-r--r-- | indoteknik_api/models/sale_order.py | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py index 75899624..e46e44d3 100644 --- a/indoteknik_api/models/product_template.py +++ b/indoteknik_api/models/product_template.py @@ -7,6 +7,11 @@ class ProductTemplate(models.Model): def api_single_response(self, product_template, with_detail=''): product_pricelist_default_discount_id = self.env['ir.config_parameter'].get_param('product.pricelist.default_discount_id') product_pricelist_default_discount_id = int(product_pricelist_default_discount_id) + voucher = self.get_voucher_pastihemat(product_template.x_manufacture.id) + newVoucherPastiHemat = {"min_purchase": voucher.min_purchase_amount or 0, + "discount_type": voucher.discount_type or '', + "discount_amount": voucher.discount_amount or 0, + "max_discount": voucher.max_discount_amount or 0,} data = { 'id': product_template.id, 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', product_template.id), @@ -18,6 +23,7 @@ class ProductTemplate(models.Model): 'weight': product_template.weight, 'manufacture': self.api_manufacture(product_template), 'categories': self.api_categories(product_template), + "newVoucherPastiHemat": newVoucherPastiHemat } if with_detail != '': diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 0771f97a..727379c5 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -87,6 +87,11 @@ class SaleOrder(models.Model): } 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) for invoice in sale_order.invoice_ids: if invoice.state == 'posted': |
