Skip to content

Commit

Permalink
Merge pull request #6 from Moka-Tourisme/16.0-add-membership_pricelis…
Browse files Browse the repository at this point in the history
…t_assignment-test

[ADD] new condition to respect odoo line_state
  • Loading branch information
PlantBasedStudio authored Apr 17, 2024
2 parents 8b75154 + 4b59d80 commit f344001
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions membership_pricelist_assignment/models/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,15 @@ def _compute_membership_state(self):
today = fields.Date.today()
invoice_state = self.account_invoice_id.state
payment_state = self.account_invoice_id.payment_state

if self.member_price <= 0:
if payment_state == "paid" and today > self.date_to:
self.state = "old"
elif self.member_price <= 0:
self._compute_membership_state_free_member(invoice_state, payment_state)
else:
self._compute_membership_state_paid_member(
invoice_state, payment_state, today
)

if payment_state == "paid" and today > self.date_to:
self.state = "old"

def _compute_membership_state_free_member(self, invoice_state, payment_state):
"""Compute membership state for free members."""
if invoice_state == "draft":
Expand Down

0 comments on commit f344001

Please sign in to comment.