Skip to content
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

[16.0] [FIX] membership_prorate: fix for calculating quantity for prorate products #173

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion membership_prorate/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _prepare_invoice_line_prorate_vals(self, invoice_line):
if date_invoice > date_to:
date_invoice = date_to
theoretical_duration = date_to - date_from + timedelta(1)
real_duration = date_to - date_invoice
real_duration = date_to - date_invoice + timedelta(1)
if theoretical_duration != real_duration:
return {
"quantity": round(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_create_invoice_membership_product_prorate_fixed(self):

def test_create_invoice_membership_product_prorate_week(self):
invoice = self.create_invoice("2015-01-01") # It's thursday
self.assertAlmostEqual(invoice.invoice_line_ids[0].quantity, 0.43, 2)
self.assertAlmostEqual(invoice.invoice_line_ids[0].quantity, 0.57, 2)
self.assertTrue(self.partner.member_lines)
self.assertEqual(self.partner.member_lines[0].state, "waiting")
self.assertEqual(
Expand All @@ -77,7 +77,7 @@ def test_create_invoice_membership_product_prorate_week(self):
def test_create_invoice_membership_product_prorate_month(self):
self.product.membership_interval_unit = "months"
invoice = self.create_invoice("2015-04-15")
self.assertAlmostEqual(invoice.invoice_line_ids[0].quantity, 0.5, 2)
self.assertAlmostEqual(invoice.invoice_line_ids[0].quantity, 0.53, 2)
self.assertTrue(self.partner.member_lines)
self.assertEqual(self.partner.member_lines[0].state, "waiting")
self.assertEqual(
Expand Down
Loading