Avoid error if CORE has invalid products.tax FK

This commit is contained in:
Lance Edgar 2023-10-08 17:35:46 -05:00
parent dbeed929fc
commit 8929d678fa

View file

@ -310,10 +310,11 @@ class ProductImporter(FromCOREPOS, corepos_importing.model.ProductImporter):
'regular_price_price': price, 'regular_price_price': price,
'regular_price_multiple': 1 if price is not None else None, 'regular_price_multiple': 1 if price is not None else None,
'regular_price_type': self.enum.PRICE_TYPE_REGULAR if price is not None else None, 'regular_price_type': self.enum.PRICE_TYPE_REGULAR if price is not None else None,
'tax_code': str(product.tax_rate.id) if product.tax_rate_id else None,
} }
if 'tax_code' in self.fields:
data['tax_code'] = str(product.tax_rate.id) if product.tax_rate else None
if self.fields_active(self.size_fields): if self.fields_active(self.size_fields):
size_info = self.normalize_size_info(product) size_info = self.normalize_size_info(product)
data.update({ data.update({