mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Add delivery_partner, delivery_partner_dhl, delivery_partner_fedex, delivery_partner_ups
This commit is contained in:
1
delivery_partner_ups/__init__.py
Normal file
1
delivery_partner_ups/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
19
delivery_partner_ups/__manifest__.py
Executable file
19
delivery_partner_ups/__manifest__.py
Executable file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
'name': 'UPS Partner Shipping Accounts',
|
||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||
'version': '11.0.1.0.0',
|
||||
'category': 'Stock',
|
||||
'sequence': 95,
|
||||
'summary': 'UPS Partner Shipping Accounts',
|
||||
'description': """
|
||||
""",
|
||||
'website': 'https://hibou.io/',
|
||||
'depends': [
|
||||
'delivery_partner',
|
||||
],
|
||||
'data': [
|
||||
'views/delivery_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
}
|
||||
1
delivery_partner_ups/models/__init__.py
Normal file
1
delivery_partner_ups/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import delivery
|
||||
19
delivery_partner_ups/models/delivery.py
Normal file
19
delivery_partner_ups/models/delivery.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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=[('ups', 'UPS')])
|
||||
ups_zip = fields.Char(string='UPS Account ZIP')
|
||||
|
||||
def ups_check_validity(self):
|
||||
m = re.search('^[\dA-Z]{6}$', self.name or '')
|
||||
if not m:
|
||||
raise ValidationError('UPS Account numbers must be 6 Alpha-numeric characters.')
|
||||
m = re.search('^\d{5}$', self.ups_zip or '')
|
||||
if not m:
|
||||
raise ValidationError('UPS requires the 5 digit account ZIP.')
|
||||
13
delivery_partner_ups/views/delivery_views.xml
Normal file
13
delivery_partner_ups/views/delivery_views.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="partner_shipping_account_view_form_inherit" model="ir.ui.view">
|
||||
<field name="name">partner.shipping.account.form.inherit</field>
|
||||
<field name="model">partner.shipping.account</field>
|
||||
<field name="inherit_id" ref="delivery_partner.partner_shipping_account_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='carrier']" position="inside">
|
||||
<field name="ups_zip" attrs="{'invisible': [('delivery_type', '!=', 'ups')], 'required': [('delivery_type', '=', 'ups')]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user