[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
This commit is contained in:
Lucas Perais (lpe)
2018-08-08 10:54:18 +02:00
parent bb8bb3cbfe
commit f2b2d87236
+2 -1
View File
@@ -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)],