From 4ed68bbf7f9a6d84708ec0e4ce0874c172872d38 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Mon, 19 Sep 2022 23:16:06 +0000 Subject: [PATCH] [ADD] delivery_partner_purolator: add for 15.0 --- delivery_partner_purolator/README.rst | 22 +++++++++++++++++++ delivery_partner_purolator/__init__.py | 1 + delivery_partner_purolator/__manifest__.py | 17 ++++++++++++++ delivery_partner_purolator/models/__init__.py | 1 + delivery_partner_purolator/models/delivery.py | 7 ++++++ delivery_partner_purolator/tests/__init__.py | 1 + .../tests/test_purolator_account.py | 20 +++++++++++++++++ 7 files changed, 69 insertions(+) create mode 100644 delivery_partner_purolator/README.rst create mode 100644 delivery_partner_purolator/__init__.py create mode 100755 delivery_partner_purolator/__manifest__.py create mode 100644 delivery_partner_purolator/models/__init__.py create mode 100644 delivery_partner_purolator/models/delivery.py create mode 100644 delivery_partner_purolator/tests/__init__.py create mode 100644 delivery_partner_purolator/tests/test_purolator_account.py diff --git a/delivery_partner_purolator/README.rst b/delivery_partner_purolator/README.rst new file mode 100644 index 00000000..7438616a --- /dev/null +++ b/delivery_partner_purolator/README.rst @@ -0,0 +1,22 @@ +******************************************* +Hibou - Purolator Partner Shipping Accounts +******************************************* + +Adds Purolator shipping accounts. + +For more information and add-ons, visit `Hibou.io `_. + + +============= +Main Features +============= + +* Adds Purolator to the delivery type selection field. + +======= +License +======= + +Please see `LICENSE `_. + +Copyright Hibou Corp. 2022 diff --git a/delivery_partner_purolator/__init__.py b/delivery_partner_purolator/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/delivery_partner_purolator/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/delivery_partner_purolator/__manifest__.py b/delivery_partner_purolator/__manifest__.py new file mode 100755 index 00000000..9419f4ac --- /dev/null +++ b/delivery_partner_purolator/__manifest__.py @@ -0,0 +1,17 @@ +{ + 'name': 'Purolator Partner Shipping Accounts', + 'author': 'Hibou Corp. ', + 'version': '15.0.1.0.0', + 'license': 'LGPL-3', + 'category': 'Stock', + 'sequence': 95, + 'summary': 'Purolator Partner Shipping Accounts', + 'website': 'https://hibou.io/', + 'depends': [ + 'delivery_partner', + ], + 'data': [ + ], + 'installable': True, + 'application': False, +} diff --git a/delivery_partner_purolator/models/__init__.py b/delivery_partner_purolator/models/__init__.py new file mode 100644 index 00000000..be8cabd6 --- /dev/null +++ b/delivery_partner_purolator/models/__init__.py @@ -0,0 +1 @@ +from . import delivery diff --git a/delivery_partner_purolator/models/delivery.py b/delivery_partner_purolator/models/delivery.py new file mode 100644 index 00000000..5f1a03ee --- /dev/null +++ b/delivery_partner_purolator/models/delivery.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class PartnerShippingAccount(models.Model): + _inherit = 'partner.shipping.account' + + delivery_type = fields.Selection(selection_add=[('purolator', 'Purolator')], ondelete={'purolator': 'set default'}) diff --git a/delivery_partner_purolator/tests/__init__.py b/delivery_partner_purolator/tests/__init__.py new file mode 100644 index 00000000..edd5b88a --- /dev/null +++ b/delivery_partner_purolator/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purolator_account diff --git a/delivery_partner_purolator/tests/test_purolator_account.py b/delivery_partner_purolator/tests/test_purolator_account.py new file mode 100644 index 00000000..c52c917e --- /dev/null +++ b/delivery_partner_purolator/tests/test_purolator_account.py @@ -0,0 +1,20 @@ +from odoo.tests.common import TransactionCase +from odoo.exceptions import ValidationError + + +class TestAccount(TransactionCase): + + def setUp(self): + super(TestAccount, self).setUp() + self.PartnerShippingAccount = self.env['partner.shipping.account'] + self.partner = self.env.ref('base.res_partner_12') + + def test_purolator_account_information(self): + # Create object and confirm that validation error raises if fedex account is blank or not 8 digits + _ = self.PartnerShippingAccount.create({ + 'name': '123456789', + 'description': 'Test Account', + 'partner_id': self.partner.id, + 'delivery_type': 'purolator', + 'note': 'This is a note' + })