[FIX] account: Register a payment with no sequence for account.payment

When registring a supplier invoice, if no sequence exists for code "account.payment.supplier.invoice"
then it failed for the creation of the counterpart lines because a name is required to create an
account move line.

ps: check function "_get_liquidity_move_line_vals" for the condition.

opw:767224
This commit is contained in:
Goffin Simon
2017-09-14 11:13:39 +02:00
parent ecc7509277
commit ce2d00f346
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -9674,6 +9674,12 @@ msgstr ""
msgid "You have"
msgstr ""
#. module: account
#: code:addons/account/models/account_payment.py:360
#, python-format
msgid "You have to define a sequence for %s in your company."
msgstr ""
#. module: account
#: code:addons/account/wizard/account_report_general_ledger.py:21
#, python-format
+2
View File
@@ -356,6 +356,8 @@ class account_payment(models.Model):
if rec.payment_type == 'outbound':
sequence_code = 'account.payment.supplier.invoice'
rec.name = self.env['ir.sequence'].with_context(ir_sequence_date=rec.payment_date).next_by_code(sequence_code)
if not rec.name and self.payment_type != 'transfer':
raise UserError(_("You have to define a sequence for %s in your company.") % (sequence_code,))
# Create the journal entry
amount = rec.amount * (rec.payment_type in ('outbound', 'transfer') and 1 or -1)