mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'mig/17.0/delivery_partner_fedex' into '17.0'
WIP: mig/17.0/delivery_partner_fedex into 17.0 See merge request hibou-io/hibou-odoo/suite!1694
This commit is contained in:
28
delivery_partner_fedex/README.rst
Normal file
28
delivery_partner_fedex/README.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
***************************************
|
||||
Hibou - FedEx Partner Shipping Accounts
|
||||
***************************************
|
||||
|
||||
Adds FedEx shipping accounts.
|
||||
|
||||
For more information and add-ons, visit `Hibou.io <https://hibou.io/>`_.
|
||||
|
||||
|
||||
=============
|
||||
Main Features
|
||||
=============
|
||||
|
||||
* Adds FedEx to the delivery type selection field.
|
||||
* Validates entered FedEx account numbers are the correct length.
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/15882954/41176817-b7353356-6b16-11e8-8545-3e59b7b350ae.png
|
||||
:alt: 'Register Payment Detail'
|
||||
:width: 988
|
||||
:align: left
|
||||
|
||||
=======
|
||||
License
|
||||
=======
|
||||
|
||||
Please see `LICENSE <https://github.com/hibou-io/hibou-odoo-suite/blob/11.0/LICENSE>`_.
|
||||
|
||||
Copyright Hibou Corp. 2023
|
||||
1
delivery_partner_fedex/__init__.py
Normal file
1
delivery_partner_fedex/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
24
delivery_partner_fedex/__manifest__.py
Executable file
24
delivery_partner_fedex/__manifest__.py
Executable file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
'name': 'Fedex Partner Shipping Accounts',
|
||||
'author': 'Hibou Corp.',
|
||||
'version': '17.0.1.0.0',
|
||||
'license': 'LGPL-3',
|
||||
'category': 'Stock',
|
||||
'sequence': 95,
|
||||
'summary': 'Fedex Partner Shipping Accounts',
|
||||
'description': """
|
||||
Fedex Partner Shipping Accounts
|
||||
===============================
|
||||
This module adds FedEx to delivery type selection dropdown on the Partner Shipping Account model.
|
||||
Additionally, it validates entered FedEx account numbers are the correct length.
|
||||
|
||||
""",
|
||||
'website': 'https://hibou.io/',
|
||||
'depends': [
|
||||
'delivery_partner',
|
||||
],
|
||||
'data': [
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
}
|
||||
37
delivery_partner_fedex/i18n/es.po
Normal file
37
delivery_partner_fedex/i18n/es.po
Normal file
@@ -0,0 +1,37 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * delivery_partner_fedex
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 15.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-10-12 01:11+0000\n"
|
||||
"PO-Revision-Date: 2021-10-12 01:11+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: delivery_partner_fedex
|
||||
#: model:ir.model.fields,field_description:delivery_partner_fedex.field_partner_shipping_account__delivery_type
|
||||
msgid "Carrier"
|
||||
msgstr "Transportista"
|
||||
|
||||
#. module: delivery_partner_fedex
|
||||
#: model:ir.model.fields.selection,name:delivery_partner_fedex.selection__partner_shipping_account__delivery_type__fedex
|
||||
msgid "FedEx"
|
||||
msgstr "FedEx"
|
||||
|
||||
#. module: delivery_partner_fedex
|
||||
#: code:addons/delivery_partner_fedex/models/delivery.py:0
|
||||
#, python-format
|
||||
msgid "FedEx Account numbers must be 9 decimal numbers."
|
||||
msgstr "Los números de cuenta FedEx deben ser 9 números decimales"
|
||||
|
||||
#. module: delivery_partner_fedex
|
||||
#: model:ir.model,name:delivery_partner_fedex.model_partner_shipping_account
|
||||
msgid "Partner Shipping Account"
|
||||
msgstr "Cuenta de Envío del Socio"
|
||||
1
delivery_partner_fedex/models/__init__.py
Normal file
1
delivery_partner_fedex/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import delivery
|
||||
15
delivery_partner_fedex/models/delivery.py
Normal file
15
delivery_partner_fedex/models/delivery.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import re
|
||||
|
||||
from odoo import fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class PartnerShippingAccount(models.Model):
|
||||
_inherit = 'partner.shipping.account'
|
||||
|
||||
delivery_type = fields.Selection(selection_add=[('fedex', 'FedEx')], ondelete={'fedex': 'set default'})
|
||||
|
||||
def fedex_check_validity(self):
|
||||
m = re.search(r'^\d{9}$', self.name or '')
|
||||
if not m:
|
||||
raise ValidationError(_('FedEx Account numbers must be 9 decimal numbers.'))
|
||||
1
delivery_partner_fedex/tests/__init__.py
Normal file
1
delivery_partner_fedex/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_fedex_account
|
||||
38
delivery_partner_fedex/tests/test_fedex_account.py
Normal file
38
delivery_partner_fedex/tests/test_fedex_account.py
Normal file
@@ -0,0 +1,38 @@
|
||||
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_fedex_account_information(self):
|
||||
# Create object and confirm that validation error raises if fedex account is blank or not 8 digits
|
||||
with self.assertRaises(ValidationError):
|
||||
wrong_account_number = self.PartnerShippingAccount.create({
|
||||
'name': '12345678',
|
||||
'description': 'Error Account',
|
||||
'partner_id': self.partner.id,
|
||||
'delivery_type': 'fedex',
|
||||
'note': 'This is a note'
|
||||
})
|
||||
|
||||
with self.assertRaises(ValidationError):
|
||||
no_account_number = self.PartnerShippingAccount.create({
|
||||
'name': '',
|
||||
'description': 'Error Account',
|
||||
'partner_id': self.partner.id,
|
||||
'delivery_type': 'fedex',
|
||||
'note': 'This is a note'
|
||||
})
|
||||
|
||||
_ = self.PartnerShippingAccount.create({
|
||||
'name': '123456789',
|
||||
'description': 'Error Account',
|
||||
'partner_id': self.partner.id,
|
||||
'delivery_type': 'fedex',
|
||||
'note': 'This is a note'
|
||||
})
|
||||
Reference in New Issue
Block a user