diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a96c8cc0222..ad5ea4383f0 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2053,7 +2053,7 @@ class AccountMove(models.Model): if not move.line_ids.filtered(lambda line: not line.display_type): raise UserError(_('You need to add a line before posting.')) if move.auto_post and move.date > fields.Date.today(): - date_msg = move.date.strftime(self.env['res.lang']._lang_get(self.env.user.lang).date_format) + date_msg = move.date.strftime(get_lang(self.env).date_format) raise UserError(_("This move is configured to be auto-posted on %s" % date_msg)) if not move.partner_id: @@ -2084,7 +2084,7 @@ class AccountMove(models.Model): self.mapped('line_ids').create_analytic_lines() for move in self: if move.auto_post and move.date > fields.Date.today(): - raise UserError(_("This move is configured to be auto-posted on {}".format(move.date.strftime(self.env['res.lang']._lang_get(self.env.user.lang).date_format)))) + raise UserError(_("This move is configured to be auto-posted on {}".format(move.date.strftime(get_lang(self.env).date_format)))) move.message_subscribe([p.id for p in [move.partner_id, move.commercial_partner_id] if p not in move.sudo().message_partner_ids])