-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[18.0][MIG] sale_procurement_group_by_line: Migration to 18.0. #3420
base: 18.0
Are you sure you want to change the base?
[18.0][MIG] sale_procurement_group_by_line: Migration to 18.0. #3420
Conversation
This module extract logic to create multiple procurement group for a single sale order for grouped sale order lines.
* Fix OCA#264 * Fix : Can't create delivery from shipping exception
* [ADD] [9.0] sale_delivery_block * [IMP] Add data with an example Delivery Block Reason. * [FIX] * Able to edit the Delivery Block Reason in state 'sent' * README * [FIX] make sale_delivery_block compatible with sale_procurement_group_by_line * [FIX] travis and data nouptade. * [ADD] delivery block tests. * [IMP] Add the 'Default Delivery Block Reason' in partners. * [IMP] track visibility of delivery block reason * [9.0][IMP] sale_delivery_block: * default_delivery_block is now a comercial field. * When duplicating a sale order the delivery block is recomputed. * [9.0][UPD] sale_delivery_block_proc_group_by_line: Update README. * [FIX] api.model used with api.constrains
Currently translated at 66.7% (2 of 3 strings) Translation: sale-workflow-11.0/sale-workflow-11.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-11-0/sale-workflow-11-0-sale_procurement_group_by_line/de/
Currently translated at 100.0% (3 of 3 strings) Translation: sale-workflow-13.0/sale-workflow-13.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_procurement_group_by_line/es/
…_qty. This avoids duplicated procurements in some cases, basically for any operation that has a specific `<sale.order.line>._get_qty_procurement` relying on `previous_product_uom_qty`. E.g: manufacturing kits, dropshipping...
…uom_qty Prevents having duplicated procurements when having several order lines involving any operation that has a specific `<sale.order.line>._get_qty_procurement` relying on `previous_product_uom_qty` (Manufacturing kits, dropshipping..)
Currently translated at 100.0% (6 of 6 strings) Translation: sale-workflow-15.0/sale-workflow-15.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_procurement_group_by_line/ca/
Before the fix, when new quantities are added into an already confirmed line, we are writing in the previous_product_uom_qty only the new qty that has been processed, not the total amount that has actually been processed for the line. Due to this, when we call super() on _action_launch_stock_rule, the new quantities are procured again, as we have not really updated the amount in previous_product_uom_qty including what we have already procured before calling super().
…ing qty in a sales order
Currently translated at 33.3% (1 of 3 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_procurement_group_by_line/it/
Currently translated at 100.0% (3 of 3 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_procurement_group_by_line/es/
Currently translated at 100.0% (3 of 3 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sale_procurement_group_by_line Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_procurement_group_by_line/de/
6d53c3f
to
7e59cd0
Compare
Sorry @RicardCForgeFlow you are not allowed to mark the addon tobe migrated. To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons. If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you include the module name in the MIG commit like: [MIG] sale_procurement_group_by_line: Migration to V18?
Code review LGTM :)
7e59cd0
to
926ec31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review LGTM
previous_product_uom_qty = {} | ||
for line in self: | ||
line = line.with_company(line.company_id) | ||
if line.state != "sale" or line.product_id.type not in ("consu", "product"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if line.state != "sale" or line.product_id.type not in ("consu", "product"): | |
if line.state != "sale" or line.order_id.locked or line.product_id.type != 'consu': |
product_qty, procurement_uom = line_uom._adjust_uom_quantities( | ||
product_qty, quant_uom | ||
) | ||
|
||
procurements.append( | ||
self.env["procurement.group"].Procurement( | ||
line.product_id, | ||
product_qty, | ||
procurement_uom, | ||
line.order_id.partner_shipping_id.property_stock_customer, | ||
line.display_name, | ||
line.order_id.name, | ||
line.order_id.company_id, | ||
values, | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
product_qty, procurement_uom = line_uom._adjust_uom_quantities( | |
product_qty, quant_uom | |
) | |
procurements.append( | |
self.env["procurement.group"].Procurement( | |
line.product_id, | |
product_qty, | |
procurement_uom, | |
line.order_id.partner_shipping_id.property_stock_customer, | |
line.display_name, | |
line.order_id.name, | |
line.order_id.company_id, | |
values, | |
) | |
) | |
origin = f'{line.order_id.name} - {line.order_id.client_order_ref}' if line.order_id.client_order_ref else line.order_id.name | |
product_qty, procurement_uom = line_uom._adjust_uom_quantities( | |
product_qty, quant_uom | |
) | |
procurements += line._create_procurements(product_qty, procurement_uom, origin, values) |
c22bae1
to
efd1ae8
Compare
self.assertEqual(self.line1.move_ids.name, self.line1.display_name) | ||
self.assertEqual(len(self.line2.move_ids), 1) | ||
self.assertEqual(self.line2.move_ids.name, self.line2.display_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.assertEqual(self.line1.move_ids.name, self.line1.display_name) | |
self.assertEqual(len(self.line2.move_ids), 1) | |
self.assertEqual(self.line2.move_ids.name, self.line2.display_name) | |
self.assertEqual(self.line1.move_ids.name, self.line1.product_id.display_name) | |
self.assertEqual(len(self.line2.move_ids), 1) | |
self.assertEqual(self.line2.move_ids.name, self.line2.product_id.display_name) |
or something like this.
It seems it's due to odoo/odoo@4cc2b3b
efd1ae8
to
cac406c
Compare
e6c97a9
to
9fc802a
Compare
9fc802a
to
1c7646d
Compare
Added v17 changes in a separated commit (a forward port of #3428). |
This PR has the |
Migration to 18.0
@ForgeFlow