Raise exception if customs_code is not set
During WPINT label generation I'm trying to remove all spaces from the customs code (HTS) by using the str.replace() method. However, if no customs code is set at all, we run into an exception as the "False" instance of the bool type doesn't have a replace() method. Closes: SYS#5451
This commit is contained in:
parent
539faec1cf
commit
879ba64ed7
|
@ -152,6 +152,8 @@ class DPDeliveryCarrier(models.Model):
|
|||
else:
|
||||
raise Warning('Product %s has no Country of Origin defined' % (ptempl.name))
|
||||
weight = ptempl.weight
|
||||
if not ptempl.customs_code:
|
||||
raise Warning('Product %s has no Customs Code defined' % (templ.name))
|
||||
hts = ptmpl.customs_code.replace(' ', '')
|
||||
desc = ptmpl.customs_description_en
|
||||
if line.procurement_id and line.procurement_id.sale_line_id:
|
||||
|
|
Loading…
Reference in New Issue