New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] account: quick edit analytic distribution posted line #144562
[FIX] account: quick edit analytic distribution posted line #144562
Conversation
With this commit we allow to change/add analytic distribution on a posted line in quick edit mode. opw-3561831
ef44176
to
e1d8548
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robodoo r+
With this commit we allow to change/add analytic distribution on a posted line in quick edit mode. opw-3561831 closes #144562 Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
1 similar comment
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@@ -210,3 +210,55 @@ def test_mandatory_plan_validation(self): | |||
invoice.invoice_line_ids.analytic_distribution = {self.analytic_account_b.id: 0.9} | |||
invoice.action_post() | |||
self.assertEqual(invoice.state, 'posted') | |||
|
|||
def test_set_anaylytic_distribution_posted_line(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anaylytic
I just see it now 🤣
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
5 similar comments
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
@guva-odoo @Levizar this pull request has forward-port PRs awaiting action (not merged or closed): |
With this commit we allow to change/add analytic distribution on a posted line in quick edit mode. opw-3561831 closes odoo#144562 Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Hello @guva-odoo The PR description suggests the user would be allowed to add or change analytic distribution. e.g.: this adapted unit test fails: def test_set_analytic_distribution_posted_line(self):
"""
Test that we can set the analytic distribution on the product line of a move, when the line has tax with
repartition lines used in tax closing. Although the change can not be applied on the tax line, we should
not raise any error.
"""
tax = self.tax_purchase_a.copy({
'name': 'taXXX',
'invoice_repartition_line_ids': [
Command.create({
'repartition_type': 'base',
'use_in_tax_closing': False,
}),
Command.create({
'repartition_type': 'tax',
'factor_percent': 50,
'use_in_tax_closing': False,
}),
Command.create({
'repartition_type': 'tax',
'factor_percent': 50,
'account_id': self.company_data['default_account_tax_purchase'].id,
'use_in_tax_closing': True,
}),
],
'refund_repartition_line_ids': [
Command.create({
'repartition_type': 'base',
'use_in_tax_closing': False,
}),
Command.create({
'repartition_type': 'tax',
'factor_percent': 50,
'use_in_tax_closing': False,
}),
Command.create({
'repartition_type': 'tax',
'factor_percent': 50,
'account_id': self.company_data['default_account_tax_purchase'].id,
'use_in_tax_closing': True,
}),
],
})
bill = self.create_invoice(self.partner_a, self.product_a, move_type='in_invoice')
bill.invoice_line_ids.tax_ids = [Command.set(tax.ids)]
+ line = bill.line_ids.filtered(lambda l: l.display_type == 'product')
+
+ # set distribution before posting
+ line.write({'analytic_distribution': {self.analytic_account_a.id: 50}})
+
+ # post the bill
bill.action_post()
+ # modify distribution
- line = bill.line_ids.filtered(lambda l: l.display_type == 'product')
line.write({'analytic_distribution': {self.analytic_account_a.id: 100}})
self.assertEqual(line.analytic_distribution, {str(self.analytic_account_a.id): 100})
I would love to have more context on that opw, in order to know if this is a design decision or a bug 😓 |
@ivantodorovich Hello! |
Thanks for the reply, @gawa-odoo ❤️ |
@guva-odoo what do we do about those fw port? |
With this commit we allow to change/add analytic distribution
on a posted line in quick edit mode.
opw-3561831