diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 72624e88d6e..ad157842ec4 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -6427,6 +6427,12 @@ msgstr "" msgid "Please create some invoice lines." msgstr "" +#. module: account +#: code:addons/account/models/account_move.py:140 +#, python-format +msgid "Please define a sequence for the refunds" +msgstr "" + #. module: account #: code:addons/account/models/account_move.py:143 #, python-format diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 117597b8fd2..b01dbd66a03 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -123,7 +123,6 @@ class AccountMove(models.Model): def post(self): invoice = self._context.get('invoice', False) self._post_validate() - for move in self: move.line_ids.create_analytic_lines() if move.name == '/': @@ -137,7 +136,10 @@ class AccountMove(models.Model): # If invoice is actually refund and journal has a refund_sequence then use that one or use the regular one sequence = journal.sequence_id if invoice and invoice.type in ['out_refund', 'in_refund'] and journal.refund_sequence: + if not journal.refund_sequence_id: + raise UserError(_('Please define a sequence for the refunds')) sequence = journal.refund_sequence_id + new_name = sequence.with_context(ir_sequence_date=move.date).next_by_id() else: raise UserError(_('Please define a sequence on the journal.'))