Ejemplo n.º 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))
Ejemplo n.º 2
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.º 3
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.º 4
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.º 5
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.º 6
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)