Skip to content

Conversation

@kevinkhao
Copy link
Contributor

No description provided.

@StefanRijnhart StefanRijnhart changed the title [IMP] sale_force_invoiced: recompute invoice amounts when changing force boolean [17.0][IMP] sale_force_invoiced: recompute invoice amounts when changing force boolean Jan 31, 2025
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

Makes sense. Is there a reason not to add force_invoiced as an @api.depends though? Something like

@api.depends("force_invoiced")
def _compute_amount_to_invoice(self):
    return super()._compute_amount_to_invoice()

-- edit -- Mmm, given that _compute_amount_to_invoice actually uses invoice_status but does not depend on it may be meaningful, so may be the override above should just set the amount to zero explicitely for sale orders that are force-invoiced.

so.amount_to_invoice,
5.0,
"Amount to invoice when invoice is not forced should be original amount",
)
Copy link
Member

Choose a reason for hiding this comment

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

This test fails.

2025-01-26T13:25:41.3342860Z 2025-01-26 13:25:41,333 298 �[1;31m�[1;49mERROR�[0m odoo odoo.addons.sale_force_invoiced.tests.test_sale_force_invoiced: FAIL: TestSaleForceInvoiced.test_sales_order
2025-01-26T13:25:41.3343574Z Traceback (most recent call last):
2025-01-26T13:25:41.3344183Z   File "/__w/sale-workflow/sale-workflow/sale_force_invoiced/tests/test_sale_force_invoiced.py", line 101, in test_sales_order
2025-01-26T13:25:41.3345029Z     self.assertEqual(
2025-01-26T13:25:41.3345466Z AssertionError: 3.45 != 5.0 : Amount to invoice when invoice is not forced should be original amount
2025-01-26T13:25:41.3345930Z  

@StefanRijnhart
Copy link
Member

Implemented my own suggestion in the port to 18: #3593

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.

2 participants