From 3307dcbdb37285bcd43a719a0ecbc1453e4af9df Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Jun 2025 15:39:41 +0700 Subject: upload payments --- fixco_custom/models/detail_order.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fixco_custom/models/detail_order.py') diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index e3dc7d7..9cbc446 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -163,16 +163,19 @@ class DetailOrder(models.Model): for item in items: product = self.env['product.product'].search( - [('default_code', '=', item.get('sku'))], + [('default_code', '=', item.get('masterSku'))], limit=1 ) # raise UserError(_("Product not found for SKU: %s") % item.get('sku')) line_data = { - 'product_id': product.id, + 'product_id': product.id if product else 5792, 'product_uom_qty': item.get('quantity'), 'price_unit': item.get('actualPrice'), } + + if not product: + line_data['name'] = f"{item.get('masterSku')} ({item.get('productName')})" order_lines.append((0, 0, line_data)) return order_lines -- cgit v1.2.3