Show attributes on Shopify webshop

Ok got it.

I want to show the attribute table, created my own module and changed in web.py the following rules for the domains:

class Shop(metaclass=PoolMeta):
    __name__ = 'web.shop'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        breakpoint()
        invisible = Eval('type') != 'shopify'
        for field in [cls.attributes, cls.attributes_removed]:
            # if field.states.get('invisible'):
            #     field.states['invisible'] |= invisible
            # else:
            #     field.states['invisible'] = invisible
            field.states['invisible'] = invisible # TODO: Könnte noch ein Problem werden, falls es schon einen OR Eintrag gibt

class Shop_Attribute(metaclass=PoolMeta):
    __name__ = 'web.shop-product.attribute'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        breakpoint()
        domain = [
            ('type', '=', 'shopify'),
            ]
        if cls.shop.domain:
            cls.shop.domain = [cls.shop.domain, domain]
        else:
            cls.shop.domain = domain

Furthermore I changed product.py

class Attribute(IdentifiersUpdateMixin, metaclass=PoolMeta):
    __name__ = 'product.attribute'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        domain = [
            ('type', '=', 'shopify'),
            ]
        if cls.web_shops.domain:
            cls.web_shops.domain = [cls.web_shops.domain, domain]
        else:
            cls.web_shops.domain = domain

But when i want to add a attribute, it says

Which one do I miss? I can’t find this domain rule.

It would be great if you can give me some hints. Thanks!

ok fixed it by simply removing the rules

product.py

class Attribute(IdentifiersUpdateMixin, metaclass=PoolMeta):
    __name__ = 'product.attribute'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        domain = ('type', '!=', 'shopify')
        if domain in cls.web_shops.domain:
            cls.web_shops.domain.remove(domain)

web.py

class Shop_Attribute(metaclass=PoolMeta):
    __name__ = 'web.shop-product.attribute'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        domain = ('type', '!=', 'shopify')      
        if domain in cls.shop.domain:
            cls.shop.domain.remove(domain)

class Shop(metaclass=PoolMeta):
    __name__ = 'web.shop'

    @classmethod
    def __setup__(cls):
        super().__setup__()
        invisible = Eval('type') != 'shopify'
        for field in [cls.attributes, cls.attributes_removed]:
            del field.states['invisible']

It is better to extend domain than removing existing clause. For that you must use an OR operator like ['OR', domain, ('type', '=', 'shopify')]

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.