[18.0][ADD] account_move_analytic: Analytic distribution at invoice and bill level#864
[18.0][ADD] account_move_analytic: Analytic distribution at invoice and bill level#864JoanSForgeFlow wants to merge 4 commits intoOCA:18.0from
Conversation
| /> | ||
| </field> | ||
| <field name="invoice_line_ids" position="attributes"> | ||
| <attribute name="context" operation="update"> |
There was a problem hiding this comment.
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'}`
There was a problem hiding this comment.
It is missing base_view_inheritance_extension dependency, Thank you @AaronHForgeFlow
24df8ca to
193e1d2
Compare
AaronHForgeFlow
left a comment
There was a problem hiding this comment.
Functional review 👍
| ) | ||
|
|
||
| @api.onchange("analytic_distribution") | ||
| def _onchange_analytic_distribution(self): |
There was a problem hiding this comment.
@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): |
There was a problem hiding this comment.
Same comment as here under
56f3b26 to
43cb47a
Compare
43cb47a to
723990a
Compare
|
Hi @rousseldenis: Thanks for the feedback! I've refactored the code:
The Let me know if this looks good. Thank you! |
| lambda ln: ln.display_type not in ("line_section", "line_note") | ||
| ) | ||
| if product_lines: | ||
| first_distribution = product_lines[0].analytic_distribution or False |
There was a problem hiding this comment.
FYI, Odoo uses first() on a recordset until v18, and then, they recommend to use next(iter())
|
@JoanSForgeFlow Ideally, an init script could be great as account moves amount on existing databases can be huge. |
account_move_analytic/pyproject.toml
Outdated
| @@ -1,3 +1,6 @@ | |||
| [project] | |||
There was a problem hiding this comment.
@JoanSForgeFlow You should not have this entry at all here. Could you remove it ?
[FIX] account_move_analytic: Remove unwanted entry in pyproject.toml
Co-authored-by: Denis Roussel (ACSONE) <rousseldenis@users.noreply.github.com>
Adds analytic distribution support on invoices and vendor bills by syncing the analytic distribution with the invoice lines.