cosmetic changes

This commit is contained in:
Marc Durepos 2024-06-11 19:03:39 -04:00
parent 06353b11e3
commit 069552d830
2 changed files with 18 additions and 11 deletions

View file

@ -5,15 +5,20 @@ from datetime import date
class Partner(models.Model): class Partner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
postpone_hold_until = fields.Date(string="Postpone Hold", postpone_hold_until = fields.Date(
help="Grace period specific to this partner despite unpaid invoices.", ) string="Postpone Hold",
help="Grace period specific to this partner despite unpaid invoices.",
tracking=True,
)
hold_bg = fields.Boolean(string="Hold (technical)", hold_bg = fields.Boolean(
compute="_compute_hold_bg", string="Hold (technical)",
store=True, compute="_compute_hold_bg",
default=False, store=True,
compute_sudo=True, default=False,
) compute_sudo=True,
tracking=True,
)
on_hold = fields.Boolean(string="Account on Hold", on_hold = fields.Boolean(string="Account on Hold",
help="Client account is on hold for unpaid overdue invoices.", help="Client account is on hold for unpaid overdue invoices.",
compute="_compute_on_hold", compute="_compute_on_hold",
@ -31,7 +36,8 @@ class Partner(models.Model):
rec.on_hold = True rec.on_hold = True
return return
# If there is no parent company or the parent is not on hold, we compute for ourselves # If there is no parent company or the parent is not on hold, we compute for ourselves
if rec.hold_bg and not (rec.postpone_hold_until and rec.postpone_hold_until > date.today()): if rec.hold_bg and not (
rec.postpone_hold_until and rec.postpone_hold_until > date.today()):
rec.on_hold = True rec.on_hold = True
else: else:
if rec.on_hold: if rec.on_hold:
@ -40,7 +46,8 @@ class Partner(models.Model):
@api.autovacuum @api.autovacuum
def _cleanup_expired_hold_postponements(self): def _cleanup_expired_hold_postponements(self):
expired_holds = self.search([('postpone_hold_until', '<=', date.today())]) expired_holds = self.search(
[('postpone_hold_until', '<=', date.today())])
expired_holds.write({'postpone_hold_until': False}) expired_holds.write({'postpone_hold_until': False})
def action_credit_hold(self): def action_credit_hold(self):

View file

@ -9,7 +9,7 @@ class MrpProduction(models.Model):
self.ensure_one() self.ensure_one()
if self.state != 'cancel': if self.state != 'cancel':
raise UserError(_( raise UserError(_(
'Only manufacturing orders in confirmed ' 'Only manufacturing orders in canceled'
'state can be set back to draft.' 'state can be set back to draft.'
)) ))
self.state = False self.state = False