-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
[14.0][IMP]Account_invoice_triple_discount: For in invoice_line_ids and not in line_ids #1442
Changes from all commits
18e8df2
e90c53f
d25a872
69c4fdf
c6e7391
7fc2600
9a26232
10df6db
43cf80b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,22 @@ def setUpClass(cls): | |
) | ||
cls.sale_journal = cls.Journal.search([("type", "=", "sale")], limit=1) | ||
|
||
def _create_refund(self): | ||
refund_form = Form( | ||
self.env["account.move"].with_context(default_move_type="in_refund") | ||
) | ||
refund_form.name = "Test Refund for Triple Discount" | ||
|
||
with refund_form.invoice_line_ids.new() as refund_line: | ||
refund_line.quantity = 10 | ||
refund_line.name = "Negative amounts" | ||
refund_line.price_unit = -2.00 | ||
refund_line.tax_ids.clear() | ||
refund_line.tax_ids.add(self.tax) | ||
|
||
refund = refund_form.save() | ||
return refund | ||
|
||
def create_simple_invoice(self, amount): | ||
invoice_form = Form( | ||
self.AccountMove.with_context( | ||
|
@@ -164,3 +180,18 @@ def test_04_discounts_decimals_tax(self): | |
invoice_form.save() | ||
|
||
self.assertEqual(invoice.amount_tax, 177.61) | ||
|
||
def test_05_refund_negative_taxes(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this locally and this test is passing even without the changes to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SirTakobi now I fixed this test and without our fix in _recompute_tax_lines it fails There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏻 |
||
""" | ||
Tests refund negative taxes | ||
""" | ||
refund = self._create_refund() | ||
for line in refund.invoice_line_ids: | ||
line.with_context(check_move_validity=False).update( | ||
{"price_unit": -line.price_unit} | ||
) | ||
refund.with_context(check_move_validity=False)._recompute_dynamic_lines( | ||
recompute_all_taxes=True, | ||
) | ||
self.assertEqual(refund.move_type, "in_refund") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this locally and here the
so I have the same concerns of 2 months ago: #1442 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@SirAionTech I don't understand what's wrong in lines recomputation at line 193... |
||
self.assertEqual(round(refund.amount_total, 2), 23.0) |
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.
This check was on
line_ids
, why is it changed? Does not seem to affect the added test result