Add delivery_partner, delivery_partner_dhl, delivery_partner_fedex, delivery_partner_ups

This commit is contained in:
Jared Kipe
2018-04-13 09:52:13 -07:00
parent 7323b9c8ed
commit ce08754d97
5 changed files with 53 additions and 0 deletions

View 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.')