From 1dd3429c9e5a9788c0b8919088f25c5617f24830 Mon Sep 17 00:00:00 2001 From: liuhehe1995 Date: Fri, 1 Dec 2023 04:11:31 +0000 Subject: [PATCH] FIX --- ...product_attribute_line_hook_name_search.py | 4 ++- product_procurement_plan/__manifest__.py | 1 + .../models/product_product.py | 8 ++++-- .../wizard/product_procurement.py | 26 +++++++++++++------ .../models/res_partner.py | 1 + .../odoo/__init__.py | 1 - .../odoo/addons/__init__.py | 1 - .../fix_product_attribute_line_name_search | 1 - .../setup.py | 6 ----- 9 files changed, 29 insertions(+), 20 deletions(-) delete mode 100644 setup/fix_product_attribute_line_name_search/odoo/__init__.py delete mode 100644 setup/fix_product_attribute_line_name_search/odoo/addons/__init__.py delete mode 120000 setup/fix_product_attribute_line_name_search/odoo/addons/fix_product_attribute_line_name_search delete mode 100644 setup/fix_product_attribute_line_name_search/setup.py diff --git a/fix_product_attribute_line_name_search/models/product_attribute_line_hook_name_search.py b/fix_product_attribute_line_name_search/models/product_attribute_line_hook_name_search.py index 3c41b1f0..0c8cfc11 100644 --- a/fix_product_attribute_line_name_search/models/product_attribute_line_hook_name_search.py +++ b/fix_product_attribute_line_name_search/models/product_attribute_line_hook_name_search.py @@ -30,7 +30,9 @@ def name_search(self, name='', args=None, operator='ilike', limit=100): ('value_ids', operator, name) ] # QTL add search_result = self.search(expression.AND([domain, args]), limit=limit) - return search_result.name_get() # QTL add + if search_result: + return search_result.name_get() # QTL add + return super(ProductAttributeLine, self).name_search( name=name, args=args, operator=operator, limit=limit ) diff --git a/product_procurement_plan/__manifest__.py b/product_procurement_plan/__manifest__.py index ce7fb612..dc1227a7 100644 --- a/product_procurement_plan/__manifest__.py +++ b/product_procurement_plan/__manifest__.py @@ -6,6 +6,7 @@ 'version': '10.0.1.2.0', 'category': 'Product', "author": "Quartile Limited", + 'website': 'https://www.quartile.co', "license": "AGPL-3", "depends": [ "purchase", diff --git a/product_procurement_plan/models/product_product.py b/product_procurement_plan/models/product_product.py index 99183198..7d71f427 100644 --- a/product_procurement_plan/models/product_product.py +++ b/product_procurement_plan/models/product_product.py @@ -70,5 +70,9 @@ def _compute_proc_lt_adj(self): @api.multi def _compute_qty_variance(self): for product in self: - product.qty_suggested = product.avg_qty_adj * product.proc_lt_adj - product.qty_variance = product.qty_available + product.incoming_qty - product.qty_suggested + product.qty_suggested = ( + product.avg_qty_adj * product.proc_lt_adj + ) + product.qty_variance = ( + product.qty_available + product.incoming_qty - product.qty_suggested + ) diff --git a/product_procurement_plan/wizard/product_procurement.py b/product_procurement_plan/wizard/product_procurement.py index 34ca39ce..c0d2e8ea 100644 --- a/product_procurement_plan/wizard/product_procurement.py +++ b/product_procurement_plan/wizard/product_procurement.py @@ -66,7 +66,9 @@ def _get_sorted_parent_products(self, products): bom_line_products = [product for product in bom_line_products] # Add lower-level products in the stack according to the BOM structure. for product in bom_line_products: - bom_lines = self.env["mrp.bom.line"].search([("product_id", "=", product.id)]) + bom_lines = self.env["mrp.bom.line"].search( + [("product_id", "=", product.id)] + ) if not bom_lines and product not in sorted_parent_products: sorted_parent_products += product for bom_line in bom_lines: @@ -118,7 +120,7 @@ def _update_qty_dict(self, qty_dict, sorted_parent_products, adjust=False): Note that qty_dict gets updated with new elements as the loop proceeds """ for prod in sorted_parent_products: - if not prod.id in qty_dict: + if prod.id not in qty_dict: continue bom = self.env["mrp.bom"]._bom_find(product=prod) for line in bom.bom_line_ids: @@ -198,7 +200,7 @@ def _get_leadtime_data(self, sorted_products): produce_products += product bom = self.env["mrp.bom"]._bom_find(product=product) for line in bom.bom_line_ids: - if not line.product_id in sorted_products: + if line.product_id not in sorted_products: sorted_products.append(line.product_id) return buy_prod_dict, produce_products @@ -229,8 +231,12 @@ def _update_lt_info_from_moves(self, moves, lt_accum, num_recs): @api.model def _update_lt_info_from_invoice_lines(self, invoice_lines, lt_accum, num_recs): for line in invoice_lines: - date_invoice = datetime.strptime(line.invoice_id.date_invoice, DATE_FORMAT) - order_date = datetime.strptime(line.purchase_line_id.order_id.date_order, DATETIME_FORMAT) + date_invoice = datetime.strptime( + line.invoice_id.date_invoice, DATE_FORMAT + ) + order_date = datetime.strptime( + line.purchase_line_id.order_id.date_order, DATETIME_FORMAT + ) lt_accum += (date_invoice - order_date).days num_recs += 1 return lt_accum, num_recs @@ -245,9 +251,13 @@ def _update_buy_prod_procure_lt(self, buy_prod_dict, from_date): lt_accum = 0.0 num_recs = 0 if product.type == "service": - invoice_lines = self.env["account.invoice.line"].search( - [("product_id", "=", product.id), ("purchase_line_id", "!=", False)] - ).filtered(lambda x: x.invoice_id.state in ("open", "paid") and x.invoice_id.date_invoice >= from_date) + invoice_lines = self.env["account.invoice.line"].search([ + ("product_id", "=", product.id), + ("purchase_line_id", "!=", False) + ]).filtered( + lambda x: x.invoice_id.state in ("open", "paid") + and x.invoice_id.date_invoice >= from_date + ) lt_accum, num_recs = self._update_lt_info_from_invoice_lines( invoice_lines, lt_accum, num_recs ) diff --git a/sale_partner_additional_info/models/res_partner.py b/sale_partner_additional_info/models/res_partner.py index edfc821a..9d2eb434 100644 --- a/sale_partner_additional_info/models/res_partner.py +++ b/sale_partner_additional_info/models/res_partner.py @@ -3,6 +3,7 @@ from odoo import fields, models + class ResPartner(models.Model): _inherit = "res.partner" diff --git a/setup/fix_product_attribute_line_name_search/odoo/__init__.py b/setup/fix_product_attribute_line_name_search/odoo/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/fix_product_attribute_line_name_search/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/fix_product_attribute_line_name_search/odoo/addons/__init__.py b/setup/fix_product_attribute_line_name_search/odoo/addons/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/fix_product_attribute_line_name_search/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/fix_product_attribute_line_name_search/odoo/addons/fix_product_attribute_line_name_search b/setup/fix_product_attribute_line_name_search/odoo/addons/fix_product_attribute_line_name_search deleted file mode 120000 index ed8dc623..00000000 --- a/setup/fix_product_attribute_line_name_search/odoo/addons/fix_product_attribute_line_name_search +++ /dev/null @@ -1 +0,0 @@ -../../../../fix_product_attribute_line_name_search \ No newline at end of file diff --git a/setup/fix_product_attribute_line_name_search/setup.py b/setup/fix_product_attribute_line_name_search/setup.py deleted file mode 100644 index 28c57bb6..00000000 --- a/setup/fix_product_attribute_line_name_search/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -setuptools.setup( - setup_requires=['setuptools-odoo'], - odoo_addon=True, -)