diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-11-29 10:53:34 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-11-29 10:53:34 +0700 |
| commit | 57ea4bce8d785ba47a12ce0b3808a7d45e4add54 (patch) | |
| tree | 292e1d78e935145b7d9a555a6512a963fcf323a5 /indoteknik_api/models | |
| parent | c5d2edf1a1e905d270e5cd1e5b6ed0cb5fa0bba1 (diff) | |
| parent | 301ad8d828e5ff43515b9f1ab467c9082fccd6f7 (diff) | |
Merge branch 'production' into iman/pengajuan-tempo
# Conflicts:
# indoteknik_custom/__manifest__.py
# indoteknik_custom/models/res_partner.py
# indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_template.py | 6 | ||||
| -rw-r--r-- | indoteknik_api/models/res_users.py | 6 | ||||
| -rw-r--r-- | indoteknik_api/models/sale_order.py | 7 |
3 files changed, 18 insertions, 1 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/res_users.py b/indoteknik_api/models/res_users.py index 230707cb..52a044dc 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -14,6 +14,9 @@ class ResUsers(models.Model): 'manager': 2, 'director': 3 } + partner_tempo = False + if main_partner: + partner_tempo = main_partner.get_check_tempo_partner() data = { 'id': res_user.id, @@ -32,7 +35,8 @@ class ResUsers(models.Model): 'feature': { 'so_approval': main_partner.use_so_approval, 'only_ready_stock': main_partner.use_only_ready_stock - } + }, + 'partner_tempo': partner_tempo } return data diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 54e1fd40..727379c5 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -39,6 +39,8 @@ class SaleOrder(models.Model): data['status'] = 'cancel' if sale_order.state in ['draft', 'sent']: data['status'] = 'draft' + if sale_order.is_continue_transaction: + data['status'] = 'waiting' if sale_order.approval_status in ['pengajuan1', 'pengajuan2']: data['status'] = 'waiting' if sale_order.state == 'sale': @@ -85,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': |
