Files
odoo_source/addons/delivery/models/product_template.py
T
Richard Mathot 108f66d69e [IMP] delivery: HS codes for product
HS Code is a standardized code used to describe products categories, and
facilitate customs clearance.
(https://en.wikipedia.org/wiki/Harmonized_System)

Some international transporters require HS codes and use them. We allow
users to store them on product.template's.
2015-12-23 16:03:09 +01:00

22 lines
783 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models, fields
class ProductTemplate(models.Model):
_inherit = 'product.template'
hs_code = fields.Char(string="HS Code", help="Standardized code for international shipping and goods declaration", oldname="x_hs_code")
@api.multi
def write(self, vals):
res = super(ProductTemplate, self).write(vals)
if vals.get('list_price'):
DeliveryCarrier = self.env['delivery.carrier']
for template in self:
carrier = DeliveryCarrier.search([('product_id', 'in', template.product_variant_ids.ids)])
if carrier:
carrier.create_price_rules()
return res