fix: refactor config.get_model() => app.model

per rattail changes
This commit is contained in:
Lance Edgar 2024-07-13 09:52:53 -05:00
parent 03bc03c9b8
commit 345d5348c3
4 changed files with 121 additions and 48 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -27,7 +27,6 @@ Rattail model importer extensions, for CORE-POS integration
import decimal
from rattail import importing
from rattail.util import pretty_quantity
##############################
@ -44,7 +43,7 @@ class PersonImporter(importing.model.PersonImporter):
def cache_query(self):
query = super().cache_query()
model = self.config.get_model()
model = self.app.model
# we want to ignore people with no CORE ID, if that's (part of) our key
if 'corepos_customer_id' in self.key:
@ -177,7 +176,7 @@ class ProductImporter(importing.model.ProductImporter):
def cache_query(self):
query = super().cache_query()
model = self.config.get_model()
model = self.app.model
# we want to ignore products with no CORE ID, if that's (part of) our key
if 'corepos_id' in self.key:
@ -219,9 +218,10 @@ class ProductImporter(importing.model.ProductImporter):
uom_code = self.get_uom_code(uom_abbrev) or self.enum.UNIT_OF_MEASURE_NONE
if unit_size is not None and uom_abbrev is not None:
size = "{} {}".format(pretty_quantity(unit_size), uom_abbrev)
size = self.app.render_quantity(unit_size)
size = f"{size} {uom_abbrev}"
elif unit_size is not None:
size = pretty_quantity(unit_size)
size = self.app.render_quantity(unit_size)
elif uom_abbrev is not None:
size = uom_abbrev
else:
@ -247,7 +247,7 @@ class ProductCostImporter(importing.model.ProductCostImporter):
def cache_query(self):
query = super().cache_query()
model = self.config.get_model()
model = self.app.model
# we want to ignore items with no CORE ID, if that's (part of) our key
if 'corepos_id' in self.key: