summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2017-09-13 15:22:42 +0200
committerGoffin Simon <sig@odoo.com>2017-09-14 11:13:39 +0200
commitce2d00f3467e616de2e75a445bb6f2cb76d30495 (patch)
tree3c620594fbfe55c94c8f26c201a8803e840f3d82 /addons
parentecc75092776ca11089772a970fba9638071322d9 (diff)
[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
Diffstat (limited to 'addons')
-rw-r--r--addons/account/i18n/account.pot6
-rw-r--r--addons/account/models/account_payment.py2
2 files changed, 8 insertions, 0 deletions
diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot
index 0b7b1461634..81687316647 100644
--- a/addons/account/i18n/account.pot
+++ b/addons/account/i18n/account.pot
@@ -9675,6 +9675,12 @@ 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
msgid "You must define a Start Date"
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index 4a49bb3b5f9..fcc2dbd0319 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -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)