Skip to content

Commit

Permalink
[IMP] make picking state syncing configurable
Browse files Browse the repository at this point in the history
By default picking state is forced to Done when SO picking is done, but if picking
sync fails, eg if there is a mismatch in SO and PO move lines, user can't correct
anything since the picking is already set to Done.

This may be acceptable in cases where 100% of the syncs go OK but we make the
setting configurable to support situations where manual corrections are needed.
  • Loading branch information
thomaspaulb committed Sep 10, 2024
1 parent 6b75626 commit de8d894
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
9 changes: 8 additions & 1 deletion purchase_sale_inter_company/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ class ResCompany(models.Model):
SELECTION_SYNC_FAILURE_ACTIONS,
string="On sync picking failure",
default="raise",
help="Pick action to perform on sync picking failure",
help="Pick action to perform on sync picking failure"
)
sync_picking_state = fields.Boolean(
string="Sync the receipt state with the delivery state",
default=lambda p: p.sync_picking,
help="State of receipt picking syncs with state of the delivery "
"from the source company. Note this disallows user to manually "
"correct or change a picking that did not sync properly.",
)
block_po_manual_picking_validation = fields.Boolean(
string="Block manual validation of picking in the destination company",
Expand Down
3 changes: 3 additions & 0 deletions purchase_sale_inter_company/models/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class InterCompanyRulesConfig(models.TransientModel):
)
sync_picking_failure_action = fields.Selection(
related="company_id.sync_picking_failure_action",
)
sync_picking_state = fields.Boolean(
related="company_id.sync_picking_state",
readonly=False,
)
block_po_manual_picking_validation = fields.Boolean(
Expand Down
3 changes: 2 additions & 1 deletion purchase_sale_inter_company/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def _compute_state(self):
res = super()._compute_state()
for picking in self:
if (
picking.intercompany_picking_id
picking.company_id.sync_picking_state
and picking.intercompany_picking_id
and picking.picking_type_code == "incoming"
and picking.state not in ["done", "cancel"]
):
Expand Down
6 changes: 6 additions & 0 deletions purchase_sale_inter_company/views/res_config_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
attrs="{'invisible': [('sync_picking_failure_action', '!=', 'notify')], 'required': [('sync_picking_failure_action', '=', 'notify')]}"
class="oe_inline"
/>
<field name="sync_picking_state" class="oe_inline" />
<label
string="Sync picking state"
class="o_light_label"
for="sync_picking_state"
/>
<br />
<field
name="block_po_manual_picking_validation"
Expand Down

0 comments on commit de8d894

Please sign in to comment.