Added the Sales Categories to migrate updated the others
This commit is contained in:
@ -4,11 +4,10 @@ import transaction
|
||||
|
||||
from pyramid.view import view_config
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import joinedload, Load
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from barker.models import ModifierCategory, Product
|
||||
from barker.models.validation_exception import ValidationError
|
||||
from barker.views import product
|
||||
|
||||
|
||||
@view_config(
|
||||
@ -192,7 +191,7 @@ def modifier_category_info(item, dbsession):
|
||||
|
||||
menu_categories = (
|
||||
dbsession.query(MenuCategory)
|
||||
.options(joinedload(MenuCategory.products, innerjoin=True))
|
||||
.join(MenuCategory.products)
|
||||
.filter(Product.is_active == True)
|
||||
.order_by(MenuCategory.sort_order, Product.sort_order, Product.name)
|
||||
.all()
|
||||
@ -247,7 +246,7 @@ def modifier_category_info(item, dbsession):
|
||||
|
||||
def add_products(modifier_category, menu_categories, dbsession):
|
||||
for mc in menu_categories:
|
||||
for p in mc['products']:
|
||||
for p in mc["products"]:
|
||||
id_ = uuid.UUID(p["id"])
|
||||
old = [p for p in modifier_category.products if p.id == id_]
|
||||
old = None if len(old) == 0 else old[0]
|
||||
|
||||
Reference in New Issue
Block a user