Ejemplo n.º 1
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.º 2
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()
Ejemplo n.º 3
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.º 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 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.º 6
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.º 7
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.º 8
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.º 9
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()