diff --git a/__openerp__.py b/__openerp__.py index 5bf111d..42e37e9 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -7,7 +7,7 @@ 'description':""" """, 'author': 'Harald Welte', - 'depends': ['odoo_shipping_service_apps'], + 'depends': ['odoo_shipping_service_apps','customs_description'], 'data': [ 'views/dp_delivery_carrier.xml', 'views/res_config.xml', diff --git a/models/dp_delivery_carrier.py b/models/dp_delivery_carrier.py index ae8b477..a8fae69 100644 --- a/models/dp_delivery_carrier.py +++ b/models/dp_delivery_carrier.py @@ -139,11 +139,8 @@ class DPDeliveryCarrier(models.Model): product_uom_obj = self.env['product.uom'] q = product_uom_obj._compute_qty_obj(self._get_default_uom(), line.product_uom_qty, self.uom_id) product = line.product_id + ptmpl = line.product_tmpl_id if product: - if product.x_sysmo_customs_code: - hts = product.x_sysmo_customs_code - else: - raise Warning('Product Variant %s has no HTS defined' % (product.name)) if product.x_country_of_origin: orig = product.x_country_of_origin.code elif line.product_tmpl_id and line.product_tmpl_id.x_country_of_origin: @@ -151,24 +148,21 @@ class DPDeliveryCarrier(models.Model): else: raise Warning('Product Variant %s has no Country of Origin defined' % (product.name)) weight = product.weight - elif line.product_tmpl_id: - ptmpl = line.product_tmpl_id - if ptempl.x_sysmo_default_customs_code: - hts = ptempl.x_sysmo_default_customs_code - else: - raise Warning('Product %s has no HTS defined' % (ptempl.name)) + else: if ptempl.x_country_of_origin: orig = ptempl.x_country_of_origin.code else: raise Warning('Product %s has no Country of Origin defined' % (ptempl.name)) weight = ptempl.weight + hts = ptmpl.customs_code.strip() + desc = ptmpl.customs_description_en if line.procurement_id and line.procurement_id.sale_line_id: price_unit = line.procurement_id.sale_line_id.price_unit else: raise Warning('Line has no procurement or procurement no sale order line?!?') weight_g = weight * 1000 line_value = q * price_unit - return wpi.build_content_item(weight_g, line_value, q, hts, orig, product.name) + return wpi.build_content_item(weight_g, line_value, q, hts, orig, desc) def build_wpi_content(self, wpi, picking): """Build contentPieces from Odoo stock.picking."""