Example #1
0
    def buildVariantsFields(self):

        # ==================================================================== #
        # Product Variation Parent Link
        FieldFactory.create(const.__SPL_T_VARCHAR__, "variant_template",
                            "Template ID")
        FieldFactory.name("Template ID")
        FieldFactory.group("Meta")
        FieldFactory.microData("http://schema.org/Product", "isVariationOf")
        FieldFactory.isReadOnly()

        # ==================================================================== #
        # CHILD PRODUCTS INFORMATION
        # ==================================================================== #

        # ==================================================================== #
        # Product Variation List - Product Link
        FieldFactory.create(
            ObjectsHelper.encode("Product", const.__SPL_T_ID__), "id")
        FieldFactory.name("Variant ID")
        FieldFactory.inlist("variants")
        FieldFactory.microData("http://schema.org/Product", "Variants")
        FieldFactory.isNotTested()

        FieldFactory.create(const.__SPL_T_VARCHAR__, "sku")
        FieldFactory.name("Variant SKU")
        FieldFactory.inlist("variants")
        FieldFactory.isReadOnly()
Example #2
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))
Example #3
0
 def buildStatusFields(self):
     # ====================================================================#
     # Order Global State
     FieldFactory.create(const.__SPL_T_VARCHAR__, "state", "Order Status")
     FieldFactory.microData("http://schema.org/Order", "orderStatus")
     FieldFactory.addChoices(OrderStatus.__get_status_choices())
     FieldFactory.group("General")
     # ====================================================================#
     # Order is Canceled
     FieldFactory.create(const.__SPL_T_BOOL__, "isCanceled", "Is canceled")
     FieldFactory.microData("http://schema.org/OrderStatus", "OrderCancelled")
     FieldFactory.group("Meta")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Order is Validated
     FieldFactory.create(const.__SPL_T_BOOL__, "isValidated", "Is Validated")
     FieldFactory.microData("http://schema.org/OrderStatus", "OrderPaymentDone")
     FieldFactory.group("Meta")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Order is Processing
     FieldFactory.create(const.__SPL_T_BOOL__, "isProcessing", "Is Processing")
     FieldFactory.microData("http://schema.org/OrderStatus", "OrderProcessing")
     FieldFactory.group("Meta")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Order is Closed
     FieldFactory.create(const.__SPL_T_BOOL__, "isClosed", "Is Closed")
     FieldFactory.microData("http://schema.org/OrderStatus", "OrderDelivered")
     FieldFactory.group("Meta")
     FieldFactory.isReadOnly()
Example #4
0
 def buildBinaryFields(self):
     # Walk on Model Binary Fields Definitions
     for fieldId, field in self.get_binary_fields_list().items():
         # Build Splash Field Definition
         FieldFactory.create(self.__BinaryTypes__[field["type"]], fieldId, field["string"])
         FieldFactory.group("Others")
         FieldFactory.isReadOnly()
         if field["required"] or fieldId in self.get_required_fields():
             FieldFactory.isRequired()
         if field["readonly"]:
             FieldFactory.isReadOnly()
         if 'help' in field:
             FieldFactory.description(field["help"])
Example #5
0
 def buildAddressTwoFields(self):
     # ====================================================================#
     # Delivery Address Country Name
     FieldFactory.create(const.__SPL_T_VARCHAR__,
                         "__shipping__country_name", "Country")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Country Code
     FieldFactory.create(const.__SPL_T_COUNTRY__,
                         "__shipping__country_code", "Country Code")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressCountry")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Phone
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__phone",
                         "Phone")
     FieldFactory.microData("http://schema.org/PostalAddress", "telephone")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Mobile Phone
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__mobile",
                         "Mobile")
     FieldFactory.microData("http://schema.org/Person", "telephone")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
Example #6
0
 def buildOrderCoreFields(self):
     # ==================================================================== #
     # Order Final Customer
     FieldFactory.create(
         ObjectsHelper.encode("ThirdParty", const.__SPL_T_ID__),
         "partner_id", "Customer")
     FieldFactory.microData("http://schema.org/Organization", "ID")
     FieldFactory.group("General")
     FieldFactory.isRequired()
     # ==================================================================== #
     # Order Billing Address
     FieldFactory.create(
         ObjectsHelper.encode("Address", const.__SPL_T_ID__),
         "partner_invoice_id", "Invoice Address")
     FieldFactory.microData("http://schema.org/Order", "billingAddress")
     FieldFactory.group("General")
     FieldFactory.isRequired()
     # ==================================================================== #
     # Order Shipping Address
     FieldFactory.create(
         ObjectsHelper.encode("Address", const.__SPL_T_ID__),
         "partner_shipping_id", "Shipping Address")
     FieldFactory.microData("http://schema.org/Order", "orderDelivery")
     FieldFactory.group("General")
     FieldFactory.isRequired()
     # ==================================================================== #
     # Order Date
     FieldFactory.create(const.__SPL_T_DATE__, "date_order", "Order Date")
     FieldFactory.microData("http://schema.org/Order", "orderDate")
     FieldFactory.group("General")
     FieldFactory.isRequired()
Example #7
0
 def buildCarrierFields(self):
     if "carrier_id" not in self.getModel().fields_get():
         return
     # ====================================================================#
     # Delivery Carrier Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "carrier_id",
                         "Carrier Name")
     FieldFactory.microData("http://schema.org/ParcelDelivery",
                            "identifier")
     FieldFactory.addChoices(M2OHelper.get_name_values("delivery.carrier"))
     FieldFactory.group("General")
     # ====================================================================#
     # Delivery Carrier Description
     FieldFactory.create(const.__SPL_T_VARCHAR__, "carrier_desc",
                         "Carrier Description")
     FieldFactory.microData("http://schema.org/ParcelDelivery", "provider")
     FieldFactory.group("General")
     FieldFactory.isReadOnly()
Example #8
0
 def buildSalesRelationFields(self):
     # ==================================================================== #
     # Sale Person Name
     if "user_id" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "user_id",
                             "Salesperson Name")
         FieldFactory.microData("http://schema.org/Author", "name")
         FieldFactory.addChoices(M2OHelper.get_name_values("res.users"))
         FieldFactory.group("General")
     # ==================================================================== #
     # Sale Person Email
     if "user_id" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "user_email",
                             "Salesperson Email")
         FieldFactory.microData("http://schema.org/Author", "email")
         FieldFactory.group("General")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Sale Team Name
     if "team_id" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "team_id",
                             "Sales team Name")
         FieldFactory.microData("http://schema.org/Author", "memberOf")
         FieldFactory.addChoices(M2OHelper.get_name_values("crm.team"))
         FieldFactory.group("General")
         FieldFactory.isNotTested()
Example #9
0
    def buildStatusFields(self):
        """
        Build Invoices Status Fields

        :return: void
        """
        # ====================================================================#
        # Order Global State
        FieldFactory.create(const.__SPL_T_VARCHAR__, "state", "Invoice Status")
        FieldFactory.microData("http://schema.org/Invoice", "paymentStatus")
        FieldFactory.addChoices(InvoiceStatus.__get_status_choices())
        FieldFactory.association("name@lines", "quantity@lines", "price_unit@lines")
        FieldFactory.group("General")
        # ====================================================================#
        # Order is Draft
        FieldFactory.create(const.__SPL_T_BOOL__, "isDraft", "Is Draft")
        FieldFactory.microData("http://schema.org/PaymentStatusType", "InvoiceDraft")
        FieldFactory.group("Meta")
        FieldFactory.isReadOnly()
        # ====================================================================#
        # Order is Canceled
        FieldFactory.create(const.__SPL_T_BOOL__, "isCanceled", "Is canceled")
        FieldFactory.microData("http://schema.org/PaymentStatusType", "PaymentDeclined")
        FieldFactory.group("Meta")
        FieldFactory.isReadOnly()
        # ====================================================================#
        # Order is Validated
        FieldFactory.create(const.__SPL_T_BOOL__, "isValidated", "Is Validated")
        FieldFactory.microData("http://schema.org/PaymentStatusType", "PaymentDue")
        FieldFactory.group("Meta")
        FieldFactory.isReadOnly()
        # ====================================================================#
        # Order is Paid
        FieldFactory.create(const.__SPL_T_BOOL__, "isPaid", "Is Paid")
        FieldFactory.microData("http://schema.org/PaymentStatusType", "PaymentComplete")
        FieldFactory.group("Meta")
        FieldFactory.isReadOnly()
Example #10
0
 def buildSafeNameFields(self):
     # ==================================================================== #
     # Sale Person Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "safe_name", "Sanitized Name")
     FieldFactory.group("General")
     FieldFactory.isReadOnly()
Example #11
0
 def buildAddressFields(self):
     # ====================================================================#
     # Delivery Address Legal Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__name",
                         "Legal Name")
     FieldFactory.microData("http://schema.org/Organization", "legalName")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # # ====================================================================#
     # # Delivery Address Legal Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__contact",
                         "Contact Name")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "alternateName")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Street
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__street",
                         "Street")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "streetAddress")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Street 2
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__street2",
                         "Street2")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "postOfficeBoxNumber")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address Zip Code
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__zip",
                         "Zip Code")
     FieldFactory.microData("http://schema.org/PostalAddress", "postalCode")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address City Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__city",
                         "City Name")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressLocality")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address State Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "__shipping__state_name",
                         "State Name")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()
     # ====================================================================#
     # Delivery Address State Code
     FieldFactory.create(const.__SPL_T_STATE__, "__shipping__state_id",
                         "State Code")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressRegion")
     FieldFactory.group("Address")
     FieldFactory.isReadOnly()