Skip to content

Commit

Permalink
[FIX] purchase_duplicate_check: Code review fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 committed Jan 20, 2025
1 parent 41e2a9d commit dbfdcd8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions purchase_duplicate_check/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
"license": "AGPL-3",
"category": "Inventory/Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"live_test_url": "https://demo.cetmix.com",
"depends": ["purchase_stock", "confirmation_wizard"],
"external_dependencies": {},
"data": [
"views/purchase_order_views.xml",
"views/res_config_settings_views.xml",
"wizard/confirmation_wizard_views.xml",
],
"assets": {},
"installable": True,
"application": False,
}
4 changes: 1 addition & 3 deletions purchase_duplicate_check/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def _prepare_pending_orders_message(self, product_id):
:return str: message
"""
message_parts = []
order_lines = self.env["purchase.order.line"].search(
[("product_id", "=", product_id), ("order_id", "in", self.ids)]
)
order_lines = self.order_line.filtered(lambda l: l.product_id.id == product_id)
for line in order_lines:
order = line.order_id
order_href = (
Expand Down
3 changes: 1 addition & 2 deletions purchase_duplicate_check/tests/test_purchase_order.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from odoo.fields import Date
from odoo.tests import Form, TransactionCase


Expand Down Expand Up @@ -43,7 +42,7 @@ def test_prepare_pending_orders_message(self):
"""Test flow where prepare message for purchase order"""
message = self.order1._prepare_pending_orders_message(self.product_2.id)
self.assertFalse(message, "Message must be empty")
expected_message = f"RFQ: <a href='/web#id={self.order1.id}&model=purchase.order'>{self.order1.name}</a> date: {Date.today()} Qty: 10.0<br/>" # noqa
expected_message = f"RFQ: <a href='/web#id={self.order1.id}&model=purchase.order'>{self.order1.name}</a> date: {self.order1.create_date.date()} Qty: 10.0<br/>" # noqa
message = self.order1._prepare_pending_orders_message(self.product_1.id)
self.assertEqual(message, expected_message, "Messages must be the same")

Expand Down

0 comments on commit dbfdcd8

Please sign in to comment.