Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purchase_sale_*_company: to 15.0 #3

Draft
wants to merge 18 commits into
base: 15.0
Choose a base branch
from

Conversation

ntsirintanis
Copy link

@ntsirintanis ntsirintanis commented Aug 21, 2024

@ntsirintanis ntsirintanis self-assigned this Aug 21, 2024
@@ -16,6 +16,14 @@
domain="[('company_id', '=', company_id)]"
/>
</xpath>
<xpath expr="//div[@id='inter_company_so_from_po']" position='before'>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after

@ntsirintanis ntsirintanis force-pushed the 15.0-purchase_sale_company_modules-PR507 branch from dd8a282 to 92b3d53 Compare August 22, 2024 07:55
@ntsirintanis ntsirintanis force-pushed the 15.0-purchase_sale_company_modules-PR507 branch from d595cb6 to 1ff65eb Compare August 26, 2024 09:33
@ntsirintanis ntsirintanis force-pushed the 15.0-purchase_sale_company_modules-PR507 branch from 1ff65eb to 9f8e7a0 Compare August 26, 2024 09:36
@ntsirintanis
Copy link
Author

ntsirintanis commented Aug 26, 2024

Test error, which I cannot reproduce locally:

2024-08-26 09:40:41,442 331 ERROR odoo odoo.addons.purchase_sale_stock_inter_company.tests.test_inter_company_purchase_sale_stock: ERROR: TestPurchaseSaleStockInterCompany.test_sync_picking
Traceback (most recent call last):
  File "/__w/multi-company/multi-company/purchase_sale_stock_inter_company/tests/test_inter_company_purchase_sale_stock.py", line 105, in test_sync_picking
    wizard.process()
  File "/opt/odoo/addons/stock/wizard/stock_backorder_confirmation.py", line 66, in process
    return pickings_to_validate.button_validate()
  File "/__w/multi-company/multi-company/purchase_sale_stock_inter_company/models/stock_picking.py", line 44, in button_validate
    res = super().button_validate()
  File "/opt/odoo/addons/stock/models/stock_picking.py", line 1022, in button_validate
    pickings_to_backorder.with_context(cancel_backorder=False)._action_done()
  File "/__w/multi-company/multi-company/purchase_sale_stock_inter_company/models/stock_picking.py", line 41, in _action_done
    return super()._action_done()
  File "/__w/multi-company/multi-company/stock_intercompany/models/stock_picking.py", line 83, in _action_done
    counterpart = picking._create_counterpart_picking()
  File "/__w/multi-company/multi-company/stock_intercompany/models/stock_picking.py", line 23, in _create_counterpart_picking
    picking.action_confirm()
  File "/opt/odoo/addons/stock/models/stock_picking.py", line 794, in action_confirm
    self.mapped('move_lines')\
  File "/opt/odoo/addons/stock/models/stock_move.py", line 1303, in _action_confirm
    self._check_company()
  File "/__w/multi-company/multi-company/base_multi_company/models/base.py", line 25, in _check_company
    super(Base, record)._check_company(fnames=fnames)
  File "/opt/odoo/odoo/models.py", line 3556, in _check_company
    raise UserError("\n".join(lines))
odoo.exceptions.UserError: Incompatible companies on records:
- 'Compa/OUT/00001/Vendors>Customers' belongs to company 'Company A' and 'Stock Rule' (rule_id: 'Compa: Stock → Customers') belongs to another company.

@thomaspaulb maybe you can assist here?

sebastienbeau and others added 3 commits August 26, 2024 12:35
Previously an intercompany picking with tracked products would simply
throw an error.

With this fix, the method searches for a lot in the destination company
that matches the one in the source company (same name and same product).
A new lot is created by duplicating the original, if none is found.
@ntsirintanis ntsirintanis changed the title purchase_sale_*_company: pickings (PR 507) purchase_sale_*_company: pickings (PR 507, 523, 541) Aug 26, 2024
…pdates

When the purchase user updates the PO after the SO is generated and
always if both are confirmed and unlocked, we sync the new lines to update the demand.

TT46773
@ntsirintanis ntsirintanis changed the title purchase_sale_*_company: pickings (PR 507, 523, 541) purchase_sale_*_company: pickings (PR 507, 523, 541, 559) Aug 27, 2024
renda-dev and others added 6 commits August 28, 2024 10:56
A number of things can go wrong in trying to confirm the PO picking
when the SO picking is confirmed. Instead of raising an error and
thereby blocking the confirm of the SO picking, provide an option by
which the exception can be caught. The SO picking will still be
confirmed, but an activity will be posted for someone to deal with the
PO picking manually.
@ntsirintanis ntsirintanis changed the title purchase_sale_*_company: pickings (PR 507, 523, 541, 559) purchase_sale_*_company: to 15.0 Aug 28, 2024
"product_id": self.stockable_product_serial.id,
"product_uom_id": self.stockable_product_serial.uom_id.id,
"qty_done": 1,
"lot_id": self.serial_3.id,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024-08-29 13:34:38,042 2528418 ERROR skata odoo.addons.purchase_sale_stock_inter_company.tests.test_inter_company_purchase_sale_stock: ERROR: TestPurchaseSaleStockInterCompany.test_sync_picking_lot
Traceback (most recent call last):
  File "/home/ntsirintanis/projects/callista/auto/addons/purchase_sale_stock_inter_company/tests/test_inter_company_purchase_sale_stock.py", line 247, in test_sync_picking_lot
    so_picking_id.button_validate()
  File "/home/ntsirintanis/projects/callista/auto/addons/purchase_sale_stock_inter_company/models/stock_picking.py", line 143, in button_validate
    record._sync_receipt_with_delivery(
  File "/home/ntsirintanis/projects/callista/auto/addons/purchase_sale_stock_inter_company/models/stock_picking.py", line 200, in _sync_receipt_with_delivery
    dest_picking.sudo().with_context(
  File "/home/ntsirintanis/projects/callista/auto/addons/purchase_sale_stock_inter_company/models/stock_picking.py", line 47, in _action_done
    return super()._action_done()
  File "/home/ntsirintanis/projects/callista/auto/addons/sale_stock/models/stock.py", line 84, in _action_done
    res = super()._action_done()
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_picking.py", line 840, in _action_done
    todo_moves._action_done(cancel_backorder=self.env.context.get('cancel_backorder'))
  File "/home/ntsirintanis/projects/callista/auto/addons/stock_account/models/stock_move.py", line 271, in _action_done
    res = super(StockMove, self)._action_done(cancel_backorder=cancel_backorder)
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_move.py", line 1762, in _action_done
    moves_todo.mapped('move_line_ids').sorted()._action_done()
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_move_line.py", line 605, in _action_done
    Quant._update_available_quantity(ml.product_id, ml.location_dest_id, quantity, lot_id=ml.lot_id, package_id=ml.result_package_id, owner_id=ml.owner_id, in_date=in_date)
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_quant.py", line 687, in _update_available_quantity
    quant.write({
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_quant.py", line 268, in write
    return super(StockQuant, self).write(vals)
  File "/home/ntsirintanis/projects/callista/custom/src/odoo/odoo/models.py", line 3905, in write
    real_recs._validate_fields(vals, inverse_fields)
  File "/home/ntsirintanis/projects/callista/custom/src/odoo/odoo/models.py", line 1378, in _validate_fields
    check(self)
  File "/home/ntsirintanis/projects/callista/auto/addons/stock/models/stock_quant.py", line 463, in check_quantity
    raise ValidationError(_('The serial number has already been assigned: \n Product: %s, Serial Number: %s') % (product.display_name, lot.name))
odoo.exceptions.ValidationError: The serial number has already been assigned: 
 Product: Stockable Product Tracked by Serial, Serial Number: 333

3,
"The quantity should decrease as it was in the purchase order",
)
self.assertEqual(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024-08-29 13:34:41,471 2528418 ERROR skata odoo.addons.purchase_sale_stock_inter_company.tests.test_inter_company_purchase_sale_stock: FAIL: TestPurchaseSaleStockInterCompany.test_update_open_sale_order
Traceback (most recent call last):
  File "/home/ntsirintanis/projects/callista/auto/addons/purchase_sale_stock_inter_company/tests/test_inter_company_purchase_sale_stock.py", line 336, in test_update_open_sale_order
    self.assertEqual(
AssertionError: 3.0 != 8 : The quantity should remain as it was as it can't be decreased from the SO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants