Skip to content

Conversation

@vvrossem
Copy link
Contributor

No description provided.

AaronHForgeFlow and others added 21 commits November 26, 2025 10:25
[UPD] Update sale_stock_picking_blocking.pot

Update translation files

Updated by Update PO files to match POT (msgmerge) hook in Weblate.
[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
@vvrossem vvrossem force-pushed the 19.0-mig-sale_stock_picking_blocking branch 2 times, most recently from fa8e4b9 to ec554bf Compare November 26, 2025 10:02
@vvrossem vvrossem force-pushed the 19.0-mig-sale_stock_picking_blocking branch from ec554bf to e9d4885 Compare November 26, 2025 10:10
Comment on lines 48 to 61

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
Copy link
Contributor Author

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,
Copy link
Contributor Author

@vvrossem vvrossem Nov 26, 2025

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

Comment on lines 140 to 187
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",
Copy link
Contributor Author

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" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@jcoux jcoux left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@rousseldenis
Copy link
Contributor

/ocabot migration sale_stock_picking_blocking

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Dec 3, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 3, 2025
96 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.