From f2b2d872360d5be241c0bac2a60bf8c788481046 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 7 Aug 2018 14:47:49 +0200 Subject: [PATCH] [FIX] account: default name for analytic line from aml Create an account_move, with at least one move line having an analytic account on it AND no label Save and Post Before this commit, the post failed because an analytic.line should have a label (required) After this commit, we fill in a default name for the analytic line, composed of the data of the line, if available, or '/' OPW 1863418 closes #26013 --- addons/account/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 879fa6cb6d4..3b8968f8912 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1459,8 +1459,9 @@ class AccountMoveLine(models.Model): an analytic account. This method is intended to be extended in other modules. """ amount = (self.credit or 0.0) - (self.debit or 0.0) + default_name = self.name or (self.ref or '/' + ' -- ' + (self.partner_id and self.partner_id.name or '/')) return { - 'name': self.name, + 'name': default_name, 'date': self.date, 'account_id': self.analytic_account_id.id, 'tag_ids': [(6, 0, self.analytic_tag_ids.ids)],