From d9431f5ff267f05af08955ce16543b31535527dd Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 26 Jan 2023 11:38:15 +0700 Subject: default sort banner api --- indoteknik_api/controllers/api_v1/banner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/banner.py b/indoteknik_api/controllers/api_v1/banner.py index 1327a749..4638d095 100644 --- a/indoteknik_api/controllers/api_v1/banner.py +++ b/indoteknik_api/controllers/api_v1/banner.py @@ -15,7 +15,9 @@ class Banner(controller.Controller): type = kw.get('type') limit = int(kw.get('limit', 0)) offset = int(kw.get('offset', 0)) - order = kw.get('order', '') + order = kw.get('order') + if not order: + order = 'write_date DESC' query = [('x_status_banner', '=', 'tayang')] if type: -- cgit v1.2.3 From 3fb9daa949bff644aedb6f0a70c57e89623475ed Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 27 Jan 2023 15:14:10 +0700 Subject: Nonaktif validasi kirim kalender --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 84a374c5..8a0ad71e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -143,7 +143,7 @@ class StockPicking(models.Model): for stock_move_line in stock_move_lines: if stock_move_line.picking_id.state not in list_state: continue - raise UserError('Sudah pernah dikirim kalender') + # raise UserError('Sudah pernah dikirim kalender') for line in self.move_line_ids_without_package: if line.move_id.sale_line_id and self.picking_type_id.code == 'outgoing': -- cgit v1.2.3 From 211abaad9849cefbf93326742a4b295a94d3b4a2 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 1 Feb 2023 11:25:16 +0700 Subject: add condition while compute margin --- indoteknik_custom/models/sale_order.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index b88d9ad0..75981275 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -355,8 +355,11 @@ class SaleOrderLine(models.Model): purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price line.item_margin = margin_per_item - # if sales_price > 0: - line.item_percent_margin = round((margin_per_item / sales_price), 2) * 100 + + if sales_price > 0: + line.item_percent_margin = round((margin_per_item / sales_price), 2) * 100 + else: + line.item_percent_margin = 0 @api.onchange('vendor_id') def onchange_vendor_id(self): -- cgit v1.2.3 From 23b787dbb798a8b34963c9e5379538d49431e2bf Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 1 Feb 2023 15:08:20 +0700 Subject: fix compute contribution delivery and fee third party --- indoteknik_custom/models/sale_order.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 75981275..7d7eb86c 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -382,13 +382,19 @@ class SaleOrderLine(models.Model): def compute_delivery_amt_line(self): for line in self: - contribution = round((line.price_total / line.order_id.amount_total), 2) + try: + contribution = round((line.price_total / line.order_id.amount_total), 2) + except: + contribution = 0 delivery_amt = line.order_id.delivery_amt line.delivery_amt_line = delivery_amt * contribution def compute_fee_third_party_line(self): for line in self: - contribution = round((line.price_total / line.order_id.amount_total), 2) + try: + contribution = round((line.price_total / line.order_id.amount_total), 2) + except: + contribution = 0 fee = line.order_id.fee_third_party line.fee_third_party_line = fee * contribution -- cgit v1.2.3