Skip to content

Commit

Permalink
Avoid crash when HS code is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Apr 20, 2018
1 parent 5300c6d commit e97337f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions delivery_roulier/models/stock_quant_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import logging
import base64

from odoo import models, api, fields
from odoo.tools.translate import _
from odoo import models, api, fields, _
from odoo.exceptions import UserError

from ..decorator import implemented_by_carrier
Expand Down Expand Up @@ -268,6 +267,11 @@ def _roulier_get_customs(self, picking):
product = operation.product_id
# stands for harmonized_system
hs = product.product_tmpl_id.get_hs_code_recursively()
if not hs:
raise UserError(_(
"No H.S. Code on product '%s' nor on it's "
"product category '%s'.")
% (product.display_name, product.categ_id.display_name))

article['quantity'] = '%.f' % operation.product_qty
article['weight'] = (
Expand Down

0 comments on commit e97337f

Please sign in to comment.