Skip to content

Commit

Permalink
to fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed Sep 28, 2023
1 parent 14b248e commit bd16806
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions shopinvader_search_engine/models/se_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def _check_model(self):
)
for se_index in self:
if (
se_index.serialize_type == "shopinvader_category_exports"
se_index.serializer_type == "shopinvader_category_exports"
and se_index.model_id != category_model
) or (
se_index.serialize_type == "shopinvader_product_exports"
se_index.serializer_type == "shopinvader_product_exports"
and se_index.model_id != product_model
):
raise ValidationError(_("'Serializer Type' must match 'Model'"))
Expand Down
8 changes: 7 additions & 1 deletion shopinvader_search_engine/tools/category_serializer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.addons.search_engine_serializer_pydantic.tools.serializer import (
PydanticModelSerializer,
)
from odoo.addons.shopinvader_product.schemas.category import ShopinvaderCategory


class ProductCategoryShopinvaderSerializer:
class ProductCategoryShopinvaderSerializer(PydanticModelSerializer):
def get_model_class(self):
return ShopinvaderCategory

def serialize(self, record):
return ShopinvaderCategory.from_shopinvader_category(record)
9 changes: 7 additions & 2 deletions shopinvader_search_engine/tools/product_serializer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.addons.search_engine_serializer_pydantic.tools.serializer import (
PydanticModelSerializer,
)
from odoo.addons.shopinvader_product.schemas.product import ShopinvaderVariant


class ProductProductShopinvaderSerializer:
class ProductProductShopinvaderSerializer(PydanticModelSerializer):
def get_model_class(self):
return ShopinvaderVariant

def serialize(self, record):
return ShopinvaderVariant.from_shopinvader_variant(record)

0 comments on commit bd16806

Please sign in to comment.