From 7a47f8abf397798ae52b4583bcc2caf4d83db874 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 19 Jul 2024 10:31:49 +0700 Subject: fix bug fullfillment --- indoteknik_custom/models/report_stock_forecasted.py | 7 +++++-- indoteknik_custom/models/solr/product_template.py | 1 - indoteknik_custom/views/sale_order.xml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/report_stock_forecasted.py b/indoteknik_custom/models/report_stock_forecasted.py index d5e48fdc..6058b7e5 100644 --- a/indoteknik_custom/models/report_stock_forecasted.py +++ b/indoteknik_custom/models/report_stock_forecasted.py @@ -10,9 +10,12 @@ class ReplenishmentReport(models.AbstractModel): for line in lines: document_out = line.get('document_out') + model_name = document_out._name - if document_out and "SO/" in document_out.name: + if document_out and model_name == 'sale.order': order_id = document_out.id + if document_out == False: + continue product_id = line.get('product', {}).get('id') query = [('product_id', '=', product_id)] @@ -32,7 +35,7 @@ class ReplenishmentReport(models.AbstractModel): 'qty_fullfillment': quantity, }) - return lines + return lines def _calculate_result(self, line): if line['document_in']: diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index b3787499..3d7d3a80 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -108,7 +108,6 @@ class ProductTemplate(models.Model): "max_discount" : voucher.max_discount_amount } }) - print(document) self.solr().add(docs=[document], softCommit=True) products = self.env['product.product'].search([ diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index ed82d28e..b8927a18 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -49,7 +49,7 @@ - + -- cgit v1.2.3