Ejemplo n.º 1
0
 def buildInventoryFields(self):
     # ==================================================================== #
     # Product Global Stock
     FieldFactory.create(const.__SPL_T_INT__, "qty_available", "Quantity On Hand")
     FieldFactory.description("Current quantity of products.")
     FieldFactory.microData("http://schema.org/Offer", "inventoryLevel")
     FieldFactory.setPreferNone()
Ejemplo n.º 2
0
 def buildParentFields(self):
     FieldFactory.create(
         ObjectsHelper.encode("ThirdParty", const.__SPL_T_ID__),
         "parent_id", "Parent")
     FieldFactory.microData("http://schema.org/Organization", "ID")
     if self.name is "Address":
         FieldFactory.isRequired()
Ejemplo n.º 3
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.º 4
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.º 5
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()
Ejemplo n.º 6
0
 def buildSafeNameFields(self):
     # ==================================================================== #
     # Sale Person Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "safe_name", "Sanitized Name")
     FieldFactory.group("General")
     FieldFactory.isReadOnly()
Ejemplo n.º 7
0
 def buildPricesFields(self):
     # ==================================================================== #
     # Load Product Configuration
     is_adv_taxes = SettingsManager.is_prd_adv_taxes()
     is_simple_prices = SettingsManager.is_prd_simple_prices()
     # ==================================================================== #
     # Product Selling Base Price
     FieldFactory.create(const.__SPL_T_PRICE__, "list_price",
                         "Base Price (tax excl.)")
     FieldFactory.description("Base Price for this Product & Variants.")
     FieldFactory.microData("http://schema.org/Product", "basePrice")
     # ==================================================================== #
     # Product Final Selling Price
     if is_simple_prices:
         FieldFactory.create(const.__SPL_T_PRICE__, "lst_price",
                             "Price (tax excl.)")
         FieldFactory.description("Final Price for Selling this Product.")
         FieldFactory.microData("http://schema.org/Product", "price")
     # ==================================================================== #
     # Product Selling Variant Price
     if is_simple_prices:
         FieldFactory.create(const.__SPL_T_PRICE__, "variant_price",
                             "Variant Price (tax excl.)")
         FieldFactory.description(
             "Final Price for this Variant. If set to Zéro, we use Base Price."
         )
         FieldFactory.microData("http://schema.org/Product", "variantPrice")
     # ==================================================================== #
     # Product Selling Extra Price (list_price - lst_price)
     FieldFactory.create(const.__SPL_T_PRICE__, "variant_price_extra",
                         "Variant Extra Price")
     FieldFactory.microData("http://schema.org/Product", "extraPrice")
     FieldFactory.isReadOnly()
     # ==================================================================== #
     # Product Cost Price
     FieldFactory.create(const.__SPL_T_PRICE__, "standard_price",
                         "Buy Price")
     FieldFactory.microData("http://schema.org/Product", "wholesalePrice")
     if is_adv_taxes:
         # ==================================================================== #
         # Product Customers Taxes
         FieldFactory.create(const.__SPL_T_VARCHAR__, "list_price_tax_ids",
                             "Sell Taxes Ids")
         FieldFactory.microData("http://schema.org/Product", "priceTaxIds")
         FieldFactory.isNotTested()
         FieldFactory.create(const.__SPL_T_VARCHAR__,
                             "list_price_tax_names", "Sell Taxes Names")
         FieldFactory.microData("http://schema.org/Product",
                                "priceTaxNames")
         FieldFactory.isNotTested()
         # ==================================================================== #
         # Product Supplier Taxes
         FieldFactory.create(const.__SPL_T_VARCHAR__,
                             "standard_price_tax_ids", "Buy Taxes Ids")
         FieldFactory.microData("http://schema.org/Product",
                                "wholesalePriceTaxIds")
         FieldFactory.isNotTested()
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_VARCHAR__,
                             "standard_price_tax_names", "Buy Taxes Names")
         FieldFactory.microData("http://schema.org/Product",
                                "priceTaxNames")
         FieldFactory.isNotTested()
Ejemplo n.º 8
0
 def buildSupplierFields(self):
     # ==================================================================== #
     # Safety Check
     if "seller_ids" not in self.getModel().fields_get():
         return
     # ====================================================================#
     # First Supplier Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "supplier_name",
                         "Supplier Name")
     FieldFactory.microData("http://schema.org/Product", "supplierName")
     FieldFactory.addChoices(
         M2OHelper.get_name_values(SupplierHelper.vendorDomain,
                                   SupplierHelper.filter))
     FieldFactory.isNotTested()
     # ====================================================================#
     # First Supplier Price as Double
     FieldFactory.create(const.__SPL_T_DOUBLE__, "supplier_price_dbl",
                         "Supplier Price (Float)")
     FieldFactory.microData("http://schema.org/Product", "supplierPriceDbl")
     FieldFactory.association("supplier_name")
     # ==================================================================== #
     # First Supplier Price
     FieldFactory.create(const.__SPL_T_PRICE__, "supplier_price",
                         "Supplier Price")
     FieldFactory.microData("http://schema.org/Product", "supplierPrice")
     FieldFactory.isWriteOnly(Framework.isDebugMode())
     FieldFactory.isNotTested()
     # ====================================================================#
     # First Supplier SKU
     FieldFactory.create(const.__SPL_T_VARCHAR__, "supplier_sku",
                         "Supplier SKU")
     FieldFactory.microData("http://schema.org/Product", "mpn")
     FieldFactory.association("supplier_name", "supplier_price_dbl")
     # ====================================================================#
     # First Supplier MOQ
     FieldFactory.create(const.__SPL_T_INT__, "supplier_min_qty",
                         "Supplier MOQ")
     FieldFactory.microData("http://schema.org/Product", "supplierMinQty")
     FieldFactory.association("supplier_name", "supplier_price_dbl")
     # ====================================================================#
     # First Supplier Currency
     FieldFactory.create(const.__SPL_T_CURRENCY__, "supplier_currency",
                         "Supplier Currency")
     FieldFactory.microData("http://schema.org/Product", "supplierCurrency")
     FieldFactory.isNotTested()
Ejemplo n.º 9
0
 def buildContactFields(self):
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "street", "Street")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "streetAddress")
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "zip", "ZIP Code")
     FieldFactory.microData("http://schema.org/PostalAddress", "postalCode")
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "city", "City Name")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressLocality")
Ejemplo n.º 10
0
 def buildInvCoreFields(self):
     # ==================================================================== #
     # Invoice Final Customer
     FieldFactory.create(
         ObjectsHelper.encode("ThirdParty", const.__SPL_T_ID__),
         "partner_id", "Customer")
     FieldFactory.microData("http://schema.org/Invoice", "customer")
     FieldFactory.group("General")
     FieldFactory.isRequired()
     # ==================================================================== #
     # Invoice 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()
     # ==================================================================== #
     # Invoice Date
     FieldFactory.create(const.__SPL_T_DATE__, "date_invoice",
                         "Invoice Date")
     FieldFactory.microData("http://schema.org/Order", "orderDate")
     FieldFactory.group("General")
     FieldFactory.isRequired()
Ejemplo n.º 11
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()
Ejemplo n.º 12
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.º 13
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.º 14
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)
Ejemplo n.º 15
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()
Ejemplo n.º 16
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"])
Ejemplo n.º 17
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()
Ejemplo n.º 18
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.º 19
0
 def buildRelationFields(self):
     # ==================================================================== #
     # Product Main category
     FieldFactory.create(const.__SPL_T_VARCHAR__, "categ_id",
                         "Categorie Id")
     FieldFactory.microData("http://schema.org/Product", "classificationId")
     FieldFactory.isReadOnly()
     FieldFactory.create(const.__SPL_T_VARCHAR__, "categ", "Categorie")
     FieldFactory.microData("http://schema.org/Product", "classification")
     FieldFactory.addChoices(M2OHelper.get_name_values("product.category"))
     FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Routes
     FieldFactory.create(const.__SPL_T_VARCHAR__, "route_ids", "Routes Ids")
     FieldFactory.microData("http://schema.org/Product", "routesId")
     FieldFactory.isReadOnly()
     FieldFactory.create(const.__SPL_T_VARCHAR__, "routes", "Routes")
     FieldFactory.microData("http://schema.org/Product", "routes")
     FieldFactory.isNotTested()
     # ==================================================================== #
     # Website category
     if "public_categ_ids" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "public_categ_ids",
                             "Categorie Id")
         FieldFactory.microData("http://schema.org/Product",
                                "publicCategoryId")
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_INLINE__, "public_categ",
                             "Public Categorie")
         FieldFactory.microData("http://schema.org/Product",
                                "publicCategory")
         FieldFactory.addChoices(
             M2OHelper.get_name_values("product.public.category"))
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Website Alternate Products
     if "alternative_product_ids" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__,
                             "alternative_products",
                             "Alternate Products Names")
         FieldFactory.microData("http://schema.org/Product",
                                "alternateModels")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Website Accessory Products
     if "accessory_product_ids" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "accessory_products",
                             "Accessory Products Names")
         FieldFactory.microData("http://schema.org/Product",
                                "crossellModels")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Allowed Companies
     if "ons_allowed_company_ids" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "company_ids",
                             "Companies IDs")
         FieldFactory.microData("http://schema.org/Product",
                                "allowedCompanies")
         FieldFactory.isNotTested()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "company_names",
                             "Companies Names")
         FieldFactory.microData("http://schema.org/Product",
                                "allowedCompaniesNames")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Brand
     if "product_brand_id" in self.getModel().fields_get():
         FieldFactory.create(const.__SPL_T_VARCHAR__, "product_brand_id",
                             "Brand Id")
         FieldFactory.microData("http://schema.org/Product", "brandId")
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "product_brand",
                             "Brand")
         FieldFactory.microData("http://schema.org/Product", "brand")
         FieldFactory.addChoices(M2OHelper.get_name_values("product.brand"))
         FieldFactory.isNotTested()
Ejemplo n.º 20
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()
Ejemplo n.º 21
0
 def buildCountryFields(self):
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_COUNTRY__, "country_code",
                         "Country Code")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressCountry")
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "country_name",
                         "Country Name")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressCountryName")
     FieldFactory.addChoices(M2OHelper.get_name_values("res.country"))
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_STATE__, "state_id", "State Code")
     FieldFactory.microData("http://schema.org/PostalAddress",
                            "addressRegion")
Ejemplo n.º 22
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.º 23
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))
Ejemplo n.º 24
0
 def buildNameFields(self):
     FieldFactory.create(const.__SPL_T_VARCHAR__, "legal", "Legal Name")
     FieldFactory.microData("http://schema.org/Organization", "legalName")
     FieldFactory.isRequired()
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "last", "Last Name")
     FieldFactory.microData("http://schema.org/Person", "givenName")
     FieldFactory.association('first')
     # ==================================================================== #
     FieldFactory.create(const.__SPL_T_VARCHAR__, "first", "First Name")
     FieldFactory.microData("http://schema.org/Person", "familyName")
Ejemplo n.º 25
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()