Skip to content

Commit

Permalink
[IMP] membership_extension & _variable_period: Make sure necessary fi…
Browse files Browse the repository at this point in the history
…elds are always truthy

This is an additional sanity check to make sure that fields that are
expected to be available are actually available.

The situation here is a little tricky. Especially as pertains date_from
and date_to; these fields are `required=True` nowhere. Not on the
product, not on the membership invoice, and not on the membership line.
However, they _are_ set as required in the product and membership line
views. If these values are ever empty, it's a sure sign that something
went wrong somewhere, because the user should not be able to reach such
a state via the UI.

One sure way to reach that state was via the demo data, however, which
had no start and end dates. This is now fixed.

The situation for the variable period fields is similar. These fields
should never be empty when the membership type is variable, and it's not
typically possible to empty these values via the UI. For convenience's
sake, I simply set them to required an sich, with a default value.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>

[BOT] post-merge updates
  • Loading branch information
carmenbianca authored and victoralmau committed Nov 13, 2024
1 parent 81014f4 commit 63d27b4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contract_membership_delegated_partner/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Contract Membership Delegate Partner
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea7cc2f3c8edeffd641d0940c7dad488562de610cba7eed1985358aa89a3673a
!! source digest: sha256:82b2fe29c3804bd488d51b712adcb72a2f269895d5af81ac29a8daee20b0f7c2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand Down
2 changes: 1 addition & 1 deletion contract_membership_delegated_partner/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Contract Membership Delegate Partner",
"version": "16.0.1.0.0",
"version": "16.0.1.0.1",
"development_status": "Production/Stable",
"category": "Membership",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Contract Membership Delegate Partner</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea7cc2f3c8edeffd641d0940c7dad488562de610cba7eed1985358aa89a3673a
!! source digest: sha256:82b2fe29c3804bd488d51b712adcb72a2f269895d5af81ac29a8daee20b0f7c2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/vertical-association/tree/16.0/contract_membership_delegated_partner"><img alt="OCA/vertical-association" src="https://img.shields.io/badge/github-OCA%2Fvertical--association-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/vertical-association-16-0/vertical-association-16-0-contract_membership_delegated_partner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/vertical-association&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to set the delegated membership at the contract so the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ class TestMembershipDelegateSetup(TestContractBase):
def setUpClass(cls):
super(TestMembershipDelegateSetup, cls).setUpClass()
cls.partner2 = cls.env["res.partner"].create({"name": "Mrs. Odoo"})
cls.product_1.membership = True
cls.product_1.write(
{
"membership_date_from": "2023-01-01",
"membership_date_to": "2023-01-02",
"membership": True,
}
)
cls.contract.delegated_member_id = cls.partner2

def test_01_generate_and_delegate(self):
Expand Down

0 comments on commit 63d27b4

Please sign in to comment.