diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
| commit | 1094670e6fc35e5150b612b32e1f497b36c022b3 (patch) | |
| tree | 4482491680db1554c28fb380480ada5282fac8f0 /indoteknik_api/models | |
| parent | c631620706a24426faea6b43c2a0602eebf9a5e4 (diff) | |
| parent | dbe24b9cd600c7b5a9d0587f80a782ed93c9a761 (diff) | |
Merge branch 'production' into iman/telegram
# Conflicts:
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/stock_picking.py
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_product.py | 5 | ||||
| -rw-r--r-- | indoteknik_api/models/product_template.py | 6 | ||||
| -rw-r--r-- | indoteknik_api/models/res_users.py | 11 | ||||
| -rw-r--r-- | indoteknik_api/models/sale_order.py | 10 |
4 files changed, 27 insertions, 5 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 386ddb6a..f8869c7d 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -61,8 +61,9 @@ class ProductProduct(models.Model): price_for = self.env.context.get('price_for', 'odoo') pricelist = pricelist or self.env.context.get('user_pricelist') default_price_tier = '1_v2' - - price_tier = pricelist.get_tier_level() + price_tier = [] + if pricelist: + price_tier = pricelist.get_tier_level() price_tier = price_tier if price_tier else default_price_tier pricelist = self._get_pricelist_tier(price_tier) 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 534898e1..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 @@ -48,7 +52,7 @@ class ResUsers(models.Model): 'street': user.street or '', 'street2': user.street2 or '', 'city': None, - 'state_id': None, + 'state_id': 0, 'district': None, 'sub_district': None, 'zip': user.zip or '', @@ -59,6 +63,9 @@ class ResUsers(models.Model): 'rajaongkir_city_id': user.kecamatan_id.rajaongkir_id or 0, 'alamat_wajib_pajak': user.alamat_lengkap_text or None, 'alamat_bisnis': user.street or None, + 'longtitude': user.longtitude or None, + 'latitude': user.latitude or None, + 'address_map': user.address_map or None, } if user.state_id: diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 725dbb4b..727379c5 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -33,12 +33,14 @@ class SaleOrder(models.Model): 'id': picking.id, 'name': picking.name, 'tracking_number': picking.delivery_tracking_no or '', - 'delivered': picking.waybill_id.delivered or picking.driver_arrival_date != False, + 'delivered': picking.waybill_id.delivered or picking.driver_arrival_date != False or picking.sj_return_date != False, }) if sale_order.state == 'cancel': 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': @@ -84,6 +86,12 @@ class SaleOrder(models.Model): '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) for invoice in sale_order.invoice_ids: if invoice.state == 'posted': |
