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
committed by Leo Pinedo
parent a1055730d9
commit bce0f17f74
4 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
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')])
def fedex_check_validity(self):
m = re.search('^\d{9}$', self.name or '')
if not m:
raise ValidationError('FedEx Account numbers must be 9 decimal numbers.')