Skip to content

Commit

Permalink
Merge pull request #558 from ursais/16.0-FIX-CAB-mass_validate_delive…
Browse files Browse the repository at this point in the history
…ry_orders

[FIX] osi_partner_credit_limit: error on hold
  • Loading branch information
RLeeOSI authored Aug 1, 2023
2 parents 066aa11 + 40c00e8 commit ba4fadf
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions osi_partner_credit_limit/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,16 @@ def _compute_allow_transfer(self):

def button_validate(self):
# Only outgoing picking
for picking in self:
if picking.picking_type_code == "outgoing":
if picking.dont_allow_transfer:
hold_tx_names = self.filtered("dont_allow_transfer").mapped(
"display_name"
)
raise UserError(
_(
"Customer on transfer(s) (%s) has a credit hold."
"\n\nContact Sales/Accounting to verify "
"sales hold/credit hold/overdue payments.",
", ".join(hold_tx_names),
)
)
else:
return super(StockPicking, self).button_validate()

# Incoming shipments / internal transfers
else:
return super(StockPicking, self).button_validate()
hold_transfers = self.filtered(
lambda p: p.picking_type_code == "outgoing" and p.dont_allow_transfer
)
if hold_transfers:
raise UserError(
_(
"Customer on transfer(s) (%s) has a credit hold."
"\n\nContact Sales/Accounting to verify "
"sales hold/credit hold/overdue payments.",
", ".join(hold_transfers.mapped("display_name")),
)
)
return super().button_validate()

0 comments on commit ba4fadf

Please sign in to comment.