diff --git a/odoo_somconnexio_python_client/resources/partner.py b/odoo_somconnexio_python_client/resources/partner.py index 64c9b263828cffda2763b9e56a4e53d0bb44bbe1..f197cb84ea2a671d8368d01e270f0161159caac8 100644 --- a/odoo_somconnexio_python_client/resources/partner.py +++ b/odoo_somconnexio_python_client/resources/partner.py @@ -30,6 +30,7 @@ class Partner: member, addresses, banned_actions, + is_company, **kwargs ): self.id = id @@ -53,6 +54,7 @@ class Partner: for address in addresses: self.addresses.append(Address(**address)) self.banned_actions = banned_actions + self.is_company = is_company @classmethod def get(cls, ref): diff --git a/tests/resources/cassettes/test_partner/PartnerTests.test_get_with_ref.yaml b/tests/resources/cassettes/test_partner/PartnerTests.test_get_with_ref.yaml index ab7f815ee5098963be50793f03192eb84eac17a4..d97d7dc72ffb9012ce5f5607ec4c5de8b2f1abc5 100644 --- a/tests/resources/cassettes/test_partner/PartnerTests.test_get_with_ref.yaml +++ b/tests/resources/cassettes/test_partner/PartnerTests.test_get_with_ref.yaml @@ -3,7 +3,7 @@ interactions: body: null headers: API-KEY: - - DUMMY + - '****' Accept: - application/json Accept-Encoding: @@ -16,30 +16,30 @@ interactions: uri: http://odoo-sc.local:8069/api/partner/1234 response: body: - string: !!python/unicode '{"id": 52, "name": "Felip Dara", "firstname": "Felip", - "lastname": "Dara", "display_name": "Dara", "ref": "1234", "lang": "en_US", - "vat": "ES55642302N", "type": "representative", "email": "felipdata@demo.net", - "phone": "", "mobile": "", "cooperator_register_number": 855, "cooperator_end_date": - "", "sponsor_ref": 0, "coop_agreement_code": "", "coop_candidate": false, "member": - true, "addresses": [{"street": "Carrer del Penal, 2", "zip_code": "17855", "city": - "Oix", "country": "Spain", "state": "Girona (Gerona)"}], "banned_actions": - ["mobile_one_shot", "mobile_tariff_change", "new_service"]}' + string: '{"id": 50, "name": "Felip Dara", "firstname": "Felip", "lastname": + "Dara", "display_name": "Dara", "ref": "1234", "lang": "es_ES", "vat": "ES55642302N", + "type": "representative", "email": "felipdata@demo.net", "phone": "", "mobile": + "", "cooperator_register_number": 855, "cooperator_end_date": "", "sponsor_ref": + "", "coop_agreement_code": "", "sponsorship_code": "RYR6O", "sponsees_number": + 1, "sponsees_max": 5, "coop_candidate": false, "member": true, "addresses": + [{"street": "Carrer del Penal, 2", "zip_code": "17855", "city": "Oix", "country": + "Spain", "state": "Girona (Gerona)"}], "banned_actions": ["new_service", "mobile_one_shot", + "mobile_tariff_change"], "inactive_sponsored": false, "is_company": false}' headers: Access-Control-Allow-Methods: - GET Access-Control-Allow-Origin: - None Content-Length: - - '517' + - '717' Content-Type: - application/json + Cookie: '****' Date: - - Wed, 19 Jan 2022 09:24:32 GMT + - Thu, 06 Feb 2025 08:20:58 GMT Server: - Werkzeug/0.11.15 Python/3.7.7 - Set-Cookie: - - session_id=7bbc7f3ced360754ef8243715949ee210d187d12; Expires=Tue, 19-Apr-2022 - 09:24:32 GMT; Max-Age=7776000; HttpOnly; Path=/ + Set-Cookie: '****' status: code: 200 message: OK diff --git a/tests/resources/cassettes/test_partner/PartnerTests.test_search_by_vat.yaml b/tests/resources/cassettes/test_partner/PartnerTests.test_search_by_vat.yaml index 280d8a5c35e164a2924d1624491d098b8f47e050..a1bcc07e9999bd771d65b85ed9f0c6ce00590c28 100644 --- a/tests/resources/cassettes/test_partner/PartnerTests.test_search_by_vat.yaml +++ b/tests/resources/cassettes/test_partner/PartnerTests.test_search_by_vat.yaml @@ -3,7 +3,7 @@ interactions: body: null headers: API-KEY: - - DUMMY + - '****' Accept: - application/json Accept-Encoding: @@ -16,30 +16,30 @@ interactions: uri: http://odoo-sc.local:8069/api/partner?vat=55642302N response: body: - string: !!python/unicode '{"id": 52, "name": "Felip Dara", "firstname": "Felip", - "lastname": "Dara", "display_name": "Dara", "ref": "1234", "lang": "en_US", - "vat": "ES55642302N", "type": "representative", "email": "felipdata@demo.net", - "phone": "", "mobile": "", "cooperator_register_number": 855, "cooperator_end_date": - "", "sponsor_ref": 0, "coop_agreement_code": "", "coop_candidate": false, "member": - true, "addresses": [{"street": "Carrer del Penal, 2", "zip_code": "17855", - "city": "Oix", "country": "Spain", "state": "Girona (Gerona)"}], - "banned_actions": ["mobile_one_shot", "mobile_tariff_change", "new_service"]}' + string: '{"id": 50, "name": "Felip Dara", "firstname": "Felip", "lastname": + "Dara", "display_name": "Dara", "ref": "1234", "lang": "es_ES", "vat": "ES55642302N", + "type": "representative", "email": "felipdata@demo.net", "phone": "", "mobile": + "", "cooperator_register_number": 855, "cooperator_end_date": "", "sponsor_ref": + "", "coop_agreement_code": "", "sponsorship_code": "RYR6O", "sponsees_number": + 1, "sponsees_max": 5, "coop_candidate": false, "member": true, "addresses": + [{"street": "Carrer del Penal, 2", "zip_code": "17855", "city": "Oix", "country": + "Spain", "state": "Girona (Gerona)"}], "banned_actions": ["new_service", "mobile_one_shot", + "mobile_tariff_change"], "inactive_sponsored": false, "is_company": false}' headers: Access-Control-Allow-Methods: - GET Access-Control-Allow-Origin: - None Content-Length: - - '517' + - '717' Content-Type: - application/json + Cookie: '****' Date: - - Wed, 19 Jan 2022 09:24:32 GMT + - Thu, 06 Feb 2025 08:20:58 GMT Server: - Werkzeug/0.11.15 Python/3.7.7 - Set-Cookie: - - session_id=cd73bf3b6b85d5fb1258d13e1b5f0f18c1c82487; Expires=Tue, 19-Apr-2022 - 09:24:32 GMT; Max-Age=7776000; HttpOnly; Path=/ + Set-Cookie: '****' status: code: 200 message: OK diff --git a/tests/resources/test_partner.py b/tests/resources/test_partner.py index 72c61346146667ebdd9caa26e4fd93603a5c5017..ae6212d2607febf682d3555a4fd1ba8982e7cc79 100644 --- a/tests/resources/test_partner.py +++ b/tests/resources/test_partner.py @@ -33,6 +33,7 @@ class PartnerTests(unittest.TestCase): assert "mobile_one_shot" in partner.banned_actions assert "mobile_tariff_change" in partner.banned_actions assert "new_service" in partner.banned_actions + self.assertFalse(partner.is_company) @pytest.mark.vcr() def test_check_sponsor_ok(self):