purchase-workflow icon indicating copy to clipboard operation
purchase-workflow copied to clipboard

[ADD][16.0] purchase_supplierinfo_packaging & purchase_stock_supplierinfo_packaging

Open benwillig opened this issue 1 year ago • 3 comments

Depends on https://github.com/OCA/product-attribute/pull/1529

This PR add two new modules:

  • purchase_supplierinfo_packaging : use the product supplier info packaging automatically when creating a purchase order
  • purchase_stock_supplierinfo_packaging : use the product supplier info packaging of the procurement when creating a purchase order

benwillig avatar Feb 28 '24 10:02 benwillig

@benwillig it seems a dependency is missing...

AttributeError: 'purchase.order.line' object has no attribute 'packaging_id'

@lmignon It should be fixed now

benwillig avatar Jul 08 '24 07:07 benwillig

@benwillig Unfortunately it seems the new addon breaks existing addons https://github.com/OCA/purchase-workflow/actions/runs/9835512761/job/27149289516?pr=2188#step:8:1311

2024-07-08 07:45:56,472 588 ERROR odoo odoo.addons.purchase_date_planned_manual.tests.test_date_planned_manual: ERROR: TestDatePlannedManual.test_no_merging_of_po_lines_if_diff_date_planned
Traceback (most recent call last):
  File "/__w/purchase-workflow/purchase-workflow/purchase_date_planned_manual/tests/test_date_planned_manual.py", line 186, in test_no_merging_of_po_lines_if_diff_date_planned
    self._run_procurement(self.product_1, origin, values)
  File "/__w/purchase-workflow/purchase-workflow/purchase_date_planned_manual/tests/test_date_planned_manual.py", line 132, in _run_procurement
    self.rule._run_buy([(procurement, rule)])
  File "/__w/purchase-workflow/purchase-workflow/purchase_request/models/stock_rule.py", line 92, in _run_buy
    return super(StockRule, self)._run_buy(procurements)
  File "/__w/purchase-workflow/purchase-workflow/procurement_purchase_no_grouping/models/stock_rule.py", line 22, in _run_buy
    return super()._run_buy(procurements)
  File "/opt/odoo/addons/purchase_stock/models/stock_rule.py", line 131, in _run_buy
    po_line = po_lines._find_candidate(*procurement)
  File "/__w/purchase-workflow/purchase-workflow/purchase_lot/models/purchase_order_line.py", line 50, in _find_candidate
    return super()._find_candidate(
  File "/__w/purchase-workflow/purchase-workflow/purchase_stock_supplierinfo_packaging/models/purchase_order_line.py", line 22, in _find_candidate
    lines_filtered = self.filtered(
  File "/opt/odoo/odoo/models.py", line 5444, in filtered
    return self.browse([rec.id for rec in self if func(rec)])
  File "/opt/odoo/odoo/models.py", line 5444, in <listcomp>
    return self.browse([rec.id for rec in self if func(rec)])
  File "/__w/purchase-workflow/purchase-workflow/purchase_stock_supplierinfo_packaging/models/purchase_order_line.py", line 23, in <lambda>
    lambda line: line.product_packaging_id == values.supplier.packaging_id
AttributeError: 'dict' object has no attribute 'supplier'

lmignon avatar Jul 08 '24 07:07 lmignon

@lmignon The multiplier quantity of your supplier info should be equal to 60 here, the inverse/onchange might have not work as expected. Theses new fields act as "helpers" to assign the real quantity so it's very simple, but maybe it doesn't match with all cases.

benwillig avatar Jul 11 '24 08:07 benwillig

@benwillig Why did you close this PR?

lmignon avatar Aug 26 '24 07:08 lmignon

@benwillig Why did you close this PR?

We went back to the old behavior using units of measure for packagings so I would have not maintain this PR anymore.

benwillig avatar Aug 28 '24 07:08 benwillig