Пример #1
0
 def buildFeaturesFields(self):
     from odoo.addons.splashsync.helpers import TransHelper
     # ====================================================================#
     # Set default System Language
     FieldFactory.setDefaultLanguage(TransHelper.get_default_iso())
     # ====================================================================#
     # Walk on Available Attributes
     for attribute in ProductsFeatures.find_all():
         # ====================================================================#
         # Walk on Available Languages
         for iso_code, lang_name in TransHelper.get_all().items():
             # ==================================================================== #
             # Product Feature Field
             FieldFactory.create(const.__SPL_T_VARCHAR__, self.encode(attribute), attribute.display_name)
             FieldFactory.group("Features")
             FieldFactory.microData("http://schema.org/Product", attribute.name)
             # ==================================================================== #
             # Add Language Params
             FieldFactory.description("["+lang_name+"] "+attribute.display_name)
             FieldFactory.setMultilang(iso_code)
             # ==================================================================== #
             # Filter Variants Attributes During Tests
             if Framework.isDebugMode() and attribute.name in AttributesHelper.attr_test:
                 FieldFactory.isNotTested()
             if iso_code != TransHelper.get_default_iso():
                 FieldFactory.association(self.encode(attribute))
Пример #2
0
 def buildAttributesFields():
     # ====================================================================#
     # Set default System Language
     FieldFactory.setDefaultLanguage(TransHelper.get_default_iso())
     # ==================================================================== #
     # Product Variation Attribute Code
     FieldFactory.create(const.__SPL_T_VARCHAR__, "code", "Attr Code")
     FieldFactory.inlist("attributes")
     FieldFactory.microData(
         "http://schema.org/Product", "VariantAttributeCode"
         if Framework.isDebugMode() else "VariantAttributeName")
     FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Variation Attribute Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "name", "Attr Name")
     FieldFactory.inlist("attributes")
     FieldFactory.isReadOnly()
     FieldFactory.isNotTested()
     if Framework.isDebugMode():
         FieldFactory.microData("http://schema.org/Product",
                                "VariantAttributeName")
     # ====================================================================#
     # Walk on Available Languages
     for iso_code, lang_name in TransHelper.get_all().items():
         # ==================================================================== #
         # Product Variation Attribute Code
         FieldFactory.create(const.__SPL_T_VARCHAR__, "value", "Attr Value")
         FieldFactory.description("[" + lang_name + "] Attr Value")
         FieldFactory.microData("http://schema.org/Product",
                                "VariantAttributeValue")
         FieldFactory.setMultilang(iso_code)
         FieldFactory.inlist("attributes")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Variation Attribute Extra Price
     if not SettingsManager.is_prd_simple_prices():
         FieldFactory.create(const.__SPL_T_DOUBLE__, "price_extra",
                             "Extra Price")
         FieldFactory.inlist("attributes")
         FieldFactory.microData(
             "http://schema.org/Product", "VariantAttributeCode"
             if Framework.isDebugMode() else "VariantExtraPrice")
         FieldFactory.isNotTested()