Skip to content

Conversation

@JoanSForgeFlow
Copy link

Adds analytic distribution support on invoices and vendor bills by syncing the analytic distribution with the invoice lines.

/>
</field>
<field name="invoice_line_ids" position="attributes">
<attribute name="context" operation="update">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why, But I get an error when installing it on runboat

`Invalid attributes 'operation' in element

View error context:
{'file': '/mnt/data/odoo-addons-dir/account_move_analytic/views/account_move_views.xml',
'line': 1,
'name': 'account.move.form - Account Move Analytic',
'view': ir.ui.view(886,),
'view.model': 'account.move',
'view.parent': ir.ui.view(682,),
'xmlid': 'view_move_form_analytic'}`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is missing base_view_inheritance_extension dependency, Thank you @AaronHForgeFlow

@JoanSForgeFlow JoanSForgeFlow force-pushed the 18.0-add-account_move_analytic branch from 24df8ca to 193e1d2 Compare January 14, 2026 12:34
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review 👍

)

@api.onchange("analytic_distribution")
def _onchange_analytic_distribution(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoanSForgeFlow analytic_distribution on lines is a stored field. Why not overriding compute method instead ?

break
move.analytic_distribution = first_distribution

def _inverse_analytic_distribution(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as here under

@JoanSForgeFlow JoanSForgeFlow force-pushed the 18.0-add-account_move_analytic branch 3 times, most recently from 56f3b26 to 43cb47a Compare January 26, 2026 11:43
@JoanSForgeFlow JoanSForgeFlow force-pushed the 18.0-add-account_move_analytic branch from 43cb47a to 723990a Compare January 26, 2026 11:47
@JoanSForgeFlow
Copy link
Author

Hi @rousseldenis:

Thanks for the feedback! I've refactored the code:

  • Removed the onchange method.
  • Added _related_analytic_distribution() override on account.move.line
  • Added move_id.analytic_distribution as a dependency to trigger line recomputation.

The inverse method is kept because it's required for the field to be editable - without it, changes wouldn't persist to the lines on save.

Let me know if this looks good. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants