-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[19.0][MIG] sale_stock_picking_blocking: Migration to 19.0 #4034
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
base: 19.0
Are you sure you want to change the base?
[19.0][MIG] sale_stock_picking_blocking: Migration to 19.0 #4034
Conversation
[UPD] README.rst
[UPD] Update sale_stock_picking_blocking.pot Update translation files Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Update translation files [ADD] icon.png
…d shoud return something
[UPD] Update sale_stock_picking_blocking.pot [UPD] README.rst Translated using Weblate (German) Currently translated at 100.0% (24 of 24 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_stock_picking_blocking Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_stock_picking_blocking/de/
[UPD] Update sale_stock_picking_blocking.pot [UPD] README.rst
fa8e4b9 to
ec554bf
Compare
ec554bf to
e9d4885
Compare
|
|
||
| def copy(self, default=None): | ||
| new_so = super().copy(default=default) | ||
| for so in new_so: | ||
| if so.partner_id.default_delivery_block and not so.delivery_block_id: | ||
| so.delivery_block_id = so.partner_id.default_delivery_block | ||
| elif ( | ||
| so.payment_term_id.default_delivery_block_reason_id | ||
| and not so.delivery_block_id | ||
| ): | ||
| so.delivery_block_id = ( | ||
| so.payment_term_id.default_delivery_block_reason_id | ||
| ) | ||
| return new_so |
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.
copy is useless since sale.order.delivery_block_id is a computed field
| "list_price": 100.0, | ||
| "standard_price": 60.0, | ||
| "uom_id": cls.env.ref("uom.product_uom_unit").id, | ||
| "uom_po_id": cls.env.ref("uom.product_uom_unit").id, |
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.
ℹ️ uom_po_id is removed in 19.0
| def test_copy_applies_delivery_block_logic(self): | ||
| """Test if copy() correctly applies delivery block from partner or payment | ||
| term""" | ||
| block_reason = self.block_model.with_user(self.user_test).create( | ||
| {"name": "Test Block Copy"} | ||
| ) | ||
| # Partner with default block reason | ||
| partner = self.env["res.partner"].create( | ||
| { | ||
| "name": "Copy Partner", | ||
| "default_delivery_block": block_reason.id, | ||
| } | ||
| ) | ||
| # Payment term with default block reason | ||
| payment_term = self.env["account.payment.term"].create( | ||
| { | ||
| "name": "Copy Payment Term", | ||
| "default_delivery_block_reason_id": block_reason.id, | ||
| } | ||
| ) | ||
| # Case 1: partner default_delivery_block applies | ||
| so = self.so_model.with_user(self.user_test).create( | ||
| { | ||
| "partner_id": partner.id, | ||
| "payment_term_id": payment_term.id, | ||
| } | ||
| ) | ||
| copied_so = so.copy() | ||
| self.assertEqual( | ||
| copied_so.delivery_block_id, | ||
| block_reason, | ||
| "Delivery block should come from partner's default_delivery_block", | ||
| ) | ||
|
|
||
| # Case 2: partner does NOT have block, but payment term does | ||
| partner.default_delivery_block = False | ||
| so_no_partner_block = self.so_model.with_user(self.user_test).create( | ||
| { | ||
| "partner_id": partner.id, | ||
| "payment_term_id": payment_term.id, | ||
| } | ||
| ) | ||
| copied_so2 = so_no_partner_block.copy() | ||
| self.assertEqual( | ||
| copied_so2.delivery_block_id, | ||
| block_reason, | ||
| "Delivery block should come from payment term's " | ||
| "default_delivery_block_reason_id", |
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.
ℹ️ testing copy() is useless: delivery_block_id is a computed field
| <odoo noupdate="1"> | ||
| <record id="group_sale_delivery_block" model="res.groups"> | ||
| <field name="name">Release Delivery Block in Sales Orders</field> | ||
| <field name="category_id" ref="base.module_category_hidden" /> |
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.
ℹ️ unused in 19.0, cf. account.group_delivery_invoice_address:
jcoux
left a comment
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 LGTM 👍
|
This PR has the |
|
/ocabot migration sale_stock_picking_blocking |
No description provided.