From c8841c8ecaf476daa2f51f63f714abd92b059748 Mon Sep 17 00:00:00 2001 From: "jerome hanke (jhk)" Date: Fri, 27 Dec 2019 12:10:35 +0000 Subject: [PATCH] [FIX] account: default date_format on res_lang lookup Steps to reproduce: -install accounting -go to accounting > accounting > assets -create a deprecable asset (account moves for deprecations are set automatically) -change your user's language to blank -try to post one of the automatically created deprecations line Previous behavior: you get a traceback error "TypeError: strftime() argument 1 must be str, not bool" Current behavior: you get the intended error message opw-2162318 closes odoo/odoo#42641 X-original-commit: 6cd38a64893428db5c2b30e85b09a34b90aa8f4f Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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])