changes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
# Part of the Fusion Plating product family.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
@@ -14,6 +14,25 @@ class ResPartner(models.Model):
|
||||
string='Account Hold', tracking=True,
|
||||
help='When active, blocks SO confirmation, invoicing, and shipping.',
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _fp_user_can_override_account_hold(self):
|
||||
"""True when the current user is allowed to override an account hold.
|
||||
|
||||
Plating Manager OR Plating Administrator qualifies. Administrator
|
||||
is checked explicitly (in addition to the implied chain) because
|
||||
Odoo's ``implied_ids`` cascade does NOT reliably propagate to
|
||||
existing users on module upgrade — admin (uid 1) typically lands
|
||||
in Administrator only, with no Manager membership. Without this
|
||||
defensive check, the highest-privileged user can't bypass holds.
|
||||
|
||||
See CLAUDE.md "Implied group cascade" rule.
|
||||
"""
|
||||
user = self.env.user
|
||||
return (
|
||||
user.has_group('fusion_plating.group_fusion_plating_manager')
|
||||
or user.has_group('fusion_plating.group_fusion_plating_administrator')
|
||||
)
|
||||
x_fc_account_hold_reason = fields.Text(string='Hold Reason')
|
||||
x_fc_account_hold_date = fields.Datetime(
|
||||
string='Hold Date', help='When the hold was placed.',
|
||||
|
||||
Reference in New Issue
Block a user