Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhehe1995 authored and AungKoKoLin1997 committed Jun 13, 2024
1 parent 33ef756 commit 1dd3429
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions product_procurement_plan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions product_procurement_plan/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
26 changes: 18 additions & 8 deletions product_procurement_plan/wizard/product_procurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions sale_partner_additional_info/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions setup/fix_product_attribute_line_name_search/setup.py

This file was deleted.

0 comments on commit 1dd3429

Please sign in to comment.