[19.0][MIG] sale_stock_picking_blocking: Migration to 19.0#4034
[19.0][MIG] sale_stock_picking_blocking: Migration to 19.0#4034OCA-git-bot merged 22 commits intoOCA:19.0from
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.
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.
ℹ️ 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.
ℹ️ 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.
ℹ️ unused in 19.0, cf. account.group_delivery_invoice_address:
|
This PR has the |
|
/ocabot migration sale_stock_picking_blocking |
|
/ocabot merge nobump |
|
What a great day to merge this nice PR. Let's do it! |
|
@rousseldenis your merge command was aborted due to failed check(s), which you can inspect on this commit of 19.0-ocabot-merge-pr-4034-by-rousseldenis-bump-nobump. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
|
/ocabot merge nobump |
|
What a great day to merge this nice PR. Let's do it! |
|
Congratulations, your PR was merged at 1c4cb48. Thanks a lot for contributing to OCA. ❤️ |
No description provided.