From 8929d678faa690daf730aafe0f5a44982d9c207a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 8 Oct 2023 17:35:46 -0500 Subject: [PATCH] Avoid error if CORE has invalid `products.tax` FK --- rattail_corepos/importing/corepos/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rattail_corepos/importing/corepos/db.py b/rattail_corepos/importing/corepos/db.py index 62fc6c5..b08a1ed 100644 --- a/rattail_corepos/importing/corepos/db.py +++ b/rattail_corepos/importing/corepos/db.py @@ -310,10 +310,11 @@ class ProductImporter(FromCOREPOS, corepos_importing.model.ProductImporter): 'regular_price_price': price, '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, - - '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): size_info = self.normalize_size_info(product) data.update({