Ejemplo n.º 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()
Ejemplo n.º 2
0
    def buildImagesFields(self):
        # ==================================================================== #
        # Ensure Field is Available
        if "product_image_ids" not in self.getModel().fields_get():
            return
        # ==================================================================== #
        # Product Images
        FieldFactory.create(const.__SPL_T_IMG__, "image", "Image")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "image")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Image Position In List
        FieldFactory.create(const.__SPL_T_INT__, "position", "Position")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "positionImage")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Is Visible Image
        FieldFactory.create(const.__SPL_T_BOOL__, "visible", "Is Visible")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "isVisibleImage")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Is Cover
        FieldFactory.create(const.__SPL_T_BOOL__, "cover", "Is Cover")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "isCover")
        FieldFactory.isNotTested()
Ejemplo n.º 3
0
    def buildImagesFields():
        # ==================================================================== #
        # Product Images
        FieldFactory.create(const.__SPL_T_IMG__, "image", "Image")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "image")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Image Position In List
        FieldFactory.create(const.__SPL_T_INT__, "position", "Position")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "positionImage")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Is Visible Image
        FieldFactory.create(const.__SPL_T_BOOL__, "visible", "Is Visible")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "isVisibleImage")
        FieldFactory.isNotTested()

        # ==================================================================== #
        # Product Images => Is Cover
        FieldFactory.create(const.__SPL_T_BOOL__, "cover", "Is Cover")
        FieldFactory.inlist("Images")
        FieldFactory.microData("http://schema.org/Product", "isCover")
        FieldFactory.isNotTested()
Ejemplo n.º 4
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()
Ejemplo n.º 5
0
 def buildDeliveryFields(self):
     # ====================================================================#
     # Delivery Qty Details (SKU)
     FieldFactory.create(const.__SPL_T_VARCHAR__, "default_code",
                         "Product SKU")
     FieldFactory.inlist("delivery")
     FieldFactory.microData("http://schema.org/OrderItem",
                            "orderItemNumber")
     FieldFactory.isNotTested()
     # ====================================================================#
     # Delivery Qty Details (Shipped)
     FieldFactory.create(const.__SPL_T_INT__, "product_uom_qty",
                         "Ordered Qty")
     FieldFactory.inlist("delivery")
     FieldFactory.microData("http://schema.org/OrderItem", "orderQuantity")
     FieldFactory.isReadOnly().isNotTested()
     # ====================================================================#
     # Delivery Qty Details (Shipped)
     FieldFactory.create(const.__SPL_T_INT__, "qty_delivered",
                         "Delivered Qty")
     FieldFactory.inlist("delivery")
     FieldFactory.microData("http://schema.org/OrderItem",
                            "orderItemStatus")
     FieldFactory.isNotTested()
Ejemplo n.º 6
0
    def buildLinesFields(self):
        """Build Order Lines Fields"""

        from odoo.addons.splashsync.helpers import SettingsManager, TaxHelper

        # ==================================================================== #
        # [CORE] Order Line Fields
        # ==================================================================== #

        # ==================================================================== #
        # Linked Product ID
        FieldFactory.create(
            ObjectsHelper.encode("Product", const.__SPL_T_ID__), "product_id",
            "Product ID")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/Product", "productID")
        FieldFactory.association("product_uom_qty@lines", "price_unit@lines")
        # ==================================================================== #
        # Description
        FieldFactory.create(const.__SPL_T_VARCHAR__, "name", "Product Desc.")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/partOfInvoice",
                               "description")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")
        # ==================================================================== #
        # Qty Ordered
        FieldFactory.create(const.__SPL_T_INT__, "product_uom_qty",
                            "Ordered Qty")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/QuantitativeValue", "value")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")
        # ==================================================================== #
        # Qty Shipped/Delivered
        FieldFactory.create(const.__SPL_T_INT__, "qty_delivered_manual",
                            "Delivered Qty")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/OrderItem", "orderDelivery")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")

        FieldFactory.isReadOnly()

        # ==================================================================== #
        # Qty Invoiced
        FieldFactory.create(const.__SPL_T_INT__, "qty_invoiced",
                            "Invoiced Qty")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/OrderItem", "orderQuantity")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")
        FieldFactory.isReadOnly()
        # ==================================================================== #
        # Line Unit Price (HT)
        FieldFactory.create(const.__SPL_T_PRICE__, "price_unit", "Unit Price")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/PriceSpecification", "price")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")
        # ==================================================================== #
        # Line Unit Price Reduction (Percent)
        FieldFactory.create(const.__SPL_T_DOUBLE__, "discount", "Discount")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/Order", "discount")
        FieldFactory.association("product_id@lines", "product_uom_qty@lines",
                                 "price_unit@lines")
        # ==================================================================== #
        # Sales Taxes (One)
        FieldFactory.create(const.__SPL_T_VARCHAR__, "tax_name", "Tax Name")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/PriceSpecification",
                               "valueAddedTaxName")
        FieldFactory.addChoices(TaxHelper.get_name_values("sale"))
        FieldFactory.isReadOnly(not SettingsManager.is_sales_adv_taxes())
        FieldFactory.isNotTested()
        # ==================================================================== #
        # Sales Taxes (Multi)
        FieldFactory.create(const.__SPL_T_INLINE__, "tax_names", "Taxes")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/PriceSpecification",
                               "valueAddedTaxNames")
        FieldFactory.addChoices(TaxHelper.get_name_values("sale"))
        FieldFactory.isReadOnly(not SettingsManager.is_sales_adv_taxes())
        FieldFactory.isNotTested()

        # ==================================================================== #
        # [EXTRA] Order Line Fields
        # ==================================================================== #

        # ==================================================================== #
        # Product reference
        FieldFactory.create(const.__SPL_T_VARCHAR__, "product_ref",
                            "Product Ref.")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/Product", "ref")
        FieldFactory.isReadOnly().isNotTested()
        # ==================================================================== #
        # Delivery Lead Time
        FieldFactory.create(const.__SPL_T_DOUBLE__, "lead_time",
                            "Customer LeadTime")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/Offer", "deliveryLeadTime")
        FieldFactory.isNotTested()
        # ==================================================================== #
        # Line Status
        FieldFactory.create(const.__SPL_T_VARCHAR__, "state", "Line Status")
        FieldFactory.inlist("lines")
        FieldFactory.microData("http://schema.org/OrderItem", "LineStatus")
        FieldFactory.isReadOnly().isNotTested()
Ejemplo n.º 7
0
    def buildPaymentsFields(self):
        """Build Invoice Payments Fields"""
        from odoo.addons.splashsync.helpers import InvoicePaymentsHelper

        # ==================================================================== #
        # [CORE] Invoice Payments Fields
        # ==================================================================== #

        # ==================================================================== #
        # Payment Method Code
        FieldFactory.create(const.__SPL_T_VARCHAR__, "journal_code", "Method")
        FieldFactory.inlist("payments")
        FieldFactory.microData("http://schema.org/Invoice", "PaymentMethod")
        FieldFactory.addChoices(InvoicePaymentsHelper.get_payment_code_names())
        FieldFactory.association("product_id@lines", "name@lines",
                                 "quantity@lines", "price_unit@lines",
                                 "journal_code@payments",
                                 "payment_date@payments", "name@payments",
                                 "amount@payments")
        # ==================================================================== #
        # Payment Journal Name
        FieldFactory.create(const.__SPL_T_VARCHAR__, "journal_name", "Journal")
        FieldFactory.inlist("payments")
        FieldFactory.isReadOnly()
        # ==================================================================== #
        # Payment Journal Type
        FieldFactory.create(const.__SPL_T_VARCHAR__, "journal_type",
                            "Journal Type")
        FieldFactory.inlist("payments")
        FieldFactory.isReadOnly()
        # ==================================================================== #
        # Payment Type
        FieldFactory.create(const.__SPL_T_VARCHAR__, "payment_type", "Type")
        FieldFactory.inlist("payments")
        FieldFactory.isReadOnly()
        # ==================================================================== #
        # Payment State
        FieldFactory.create(const.__SPL_T_VARCHAR__, "state", "Status")
        FieldFactory.inlist("payments")
        FieldFactory.isReadOnly()
        # ==================================================================== #
        # Payment Date
        FieldFactory.create(const.__SPL_T_DATE__, "payment_date", "Date")
        FieldFactory.inlist("payments")
        FieldFactory.microData("http://schema.org/PaymentChargeSpecification",
                               "validFrom")
        FieldFactory.association("product_id@lines", "name@lines",
                                 "quantity@lines", "price_unit@lines",
                                 "journal_code@payments",
                                 "payment_date@payments", "name@payments",
                                 "amount@payments")
        # ==================================================================== #
        # Payment Transaction Id
        FieldFactory.create(const.__SPL_T_VARCHAR__, "name", "Number")
        FieldFactory.inlist("payments")
        FieldFactory.microData("http://schema.org/Invoice", "paymentMethodId")
        FieldFactory.association("product_id@lines", "name@lines",
                                 "quantity@lines", "price_unit@lines",
                                 "journal_code@payments",
                                 "payment_date@payments", "name@payments",
                                 "amount@payments")
        # ==================================================================== #
        # Payment Amount
        FieldFactory.create(const.__SPL_T_DOUBLE__, "amount", "Amount")
        FieldFactory.inlist("payments")
        FieldFactory.microData("http://schema.org/PaymentChargeSpecification",
                               "price")
        FieldFactory.association("product_id@lines", "name@lines",
                                 "quantity@lines", "price_unit@lines",
                                 "journal_code@payments",
                                 "payment_date@payments", "name@payments",
                                 "amount@payments")
        if Framework.isDebugMode():
            FieldFactory.addChoice(1.0, 1)
            FieldFactory.addChoice(2.0, 2)
            FieldFactory.addChoice(3.0, 3)