[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:
@@ -1459,8 +1459,9 @@ class AccountMoveLine(models.Model):
|
|||||||
an analytic account. This method is intended to be extended in other modules.
|
an analytic account. This method is intended to be extended in other modules.
|
||||||
"""
|
"""
|
||||||
amount = (self.credit or 0.0) - (self.debit or 0.0)
|
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 {
|
return {
|
||||||
'name': self.name,
|
'name': default_name,
|
||||||
'date': self.date,
|
'date': self.date,
|
||||||
'account_id': self.analytic_account_id.id,
|
'account_id': self.analytic_account_id.id,
|
||||||
'tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
|
'tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
|
||||||
|
|||||||
Reference in New Issue
Block a user