diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-02 08:23:23 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-02 08:23:23 +0700 |
| commit | 7a9d9caea54dd616fd550c49ea954f8a2362c4a7 (patch) | |
| tree | 5fc1920569f174290861c4740a7de12bb35cc0f4 | |
| parent | 60e57d97be4033e43eca982ba833156e69a9cbf6 (diff) | |
| parent | 23b787dbb798a8b34963c9e5379538d49431e2bf (diff) | |
Merge branch 'release' into feature/rest-api
| -rw-r--r-- | indoteknik_api/controllers/api_v1/banner.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 17 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 |
3 files changed, 17 insertions, 6 deletions
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: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index b88d9ad0..7d7eb86c 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): @@ -379,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 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': |
