Пример #1
0
 def setCarrierFields(self, field_id, field_data):
     # ====================================================================#
     # Delivery Carrier Name
     if field_id == "carrier_id":
         M2OHelper.set_name(self.object,
                            field_id,
                            field_data,
                            domain="delivery.carrier")
         self._in.__delitem__(field_id)
Пример #2
0
 def __set_supplier_values(self, field_id, field_data, supplier):
     """
     Set Product Supplier Fields
     :param field_id: str
     :param field_data: hash
     :param supplier: product.supplierinfo
     :return: None
     """
     # ====================================================================#
     # Set Value
     self._in.__delitem__(field_id)
     if field_id == "supplier_name":
         # ====================================================================#
         # Validate & Update Supplier Partner
         new_currency = M2OHelper.verify_name(field_data, "name",
                                              SupplierHelper.vendorDomain,
                                              SupplierHelper.filter)
         if new_currency is not None and new_currency > 0:
             M2OHelper.set_name(supplier,
                                "name",
                                field_data,
                                domain=SupplierHelper.vendorDomain,
                                filters=SupplierHelper.filter)
     elif field_id == "supplier_sku":
         supplier.product_code = field_data
     elif field_id == "supplier_min_qty":
         supplier.min_qty = field_data
     elif field_id == "supplier_price_dbl":
         supplier.price = field_data
     elif field_id == "supplier_price":
         try:
             supplier.price = float(PricesHelper.taxExcluded(field_data))
         except TypeError:
             supplier.price = 0
     elif field_id == "supplier_currency":
         # ====================================================================#
         # Validate & Update Supplier Partner
         new_currency = M2OHelper.verify_name(field_data, "name",
                                              "res.currency")
         if new_currency is not None and new_currency > 0:
             M2OHelper.set_name(supplier,
                                "currency_id",
                                field_data,
                                domain="res.currency")
Пример #3
0
 def setSalesRelationFields(self, field_id, field_data):
     # Check if Relation Field...
     if not self.isSalesRelationFields(field_id):
         return
     # ==================================================================== #
     # Sale Person Name
     if field_id == "user_id":
         M2OHelper.set_name(self.object,
                            "user_id",
                            field_data,
                            domain="res.users")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Sale Person Email
     if field_id == "user_email":
         M2OHelper.set_name(self.object,
                            "user_id",
                            field_data,
                            'email',
                            domain="res.users")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Sale Team Name
     if field_id == "team_id":
         M2OHelper.set_name(self.object,
                            "team_id",
                            field_data,
                            domain="crm.team")
         self._in.__delitem__(field_id)
Пример #4
0
 def setRelationFields(self, field_id, field_data):
     # Check if Relation Field...
     if not self.isRelationFields(field_id):
         return
     # ==================================================================== #
     # Categorie
     if field_id == "categ_id":
         M2OHelper.set_id(self.object,
                          "categ_id",
                          field_data,
                          domain="product.category")
         self._in.__delitem__(field_id)
     if field_id == "categ":
         M2OHelper.set_name(self.object,
                            "categ_id",
                            field_data,
                            domain="product.category")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Routes
     if field_id == "route_ids":
         M2MHelper.set_ids(self.object,
                           "route_ids",
                           field_data,
                           domain="stock.location.route")
         self._in.__delitem__(field_id)
     if field_id == "routes":
         M2MHelper.set_names(self.object,
                             "route_ids",
                             field_data,
                             domain="stock.location.route")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Public Categories
     if field_id == "public_categ_ids":
         M2MHelper.set_ids(self.object,
                           "public_categ_ids",
                           field_data,
                           domain="product.public.category")
         self._in.__delitem__(field_id)
     if field_id == "public_categ":
         M2MHelper.set_names(self.object,
                             "public_categ_ids",
                             field_data,
                             domain="product.public.category")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Website Alternate Products
     if field_id == "alternative_products":
         M2MHelper.set_names(self.object,
                             "alternative_product_ids",
                             field_data,
                             domain="product.template")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Website Alternate Products
     if field_id == "accessory_products":
         M2MHelper.set_names(self.object,
                             "accessory_product_ids",
                             field_data,
                             domain="product.product")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Allowed Companies
     if field_id == "company_ids":
         M2MHelper.set_ids(self.object,
                           "ons_allowed_company_ids",
                           field_data,
                           domain="res.company")
         self._in.__delitem__(field_id)
     if field_id == "company_names":
         M2MHelper.set_names(self.object,
                             "ons_allowed_company_ids",
                             field_data,
                             domain="res.company")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Product Brand
     if field_id == "product_brand_id":
         M2OHelper.set_id(self.object,
                          "product_brand_id",
                          field_data,
                          domain="product.brand")
         self._in.__delitem__(field_id)
     if field_id == "product_brand":
         M2OHelper.set_name(self.object,
                            "product_brand_id",
                            field_data,
                            domain="product.brand")
         self._in.__delitem__(field_id)
Пример #5
0
 def setProductsRelationsFields(self, field_id, field_data):
     # Check if Relation Field...
     if not self.isProductRelationFields(field_id):
         return
     # ==================================================================== #
     # Category
     if field_id == "categ_id":
         M2OHelper.set_id(self.object,
                          "categ_id",
                          field_data,
                          domain="product.category",
                          nullable=False)
         self._in.__delitem__(field_id)
     if field_id == "categ":
         M2OHelper.set_name(self.object,
                            "categ_id",
                            field_data,
                            domain="product.category",
                            nullable=False)
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Routes
     if field_id == "route_ids":
         M2MHelper.set_ids(self.object,
                           "route_ids",
                           field_data,
                           domain="stock.location.route")
         self._in.__delitem__(field_id)
     if field_id == "routes":
         M2MHelper.set_names(self.object,
                             "route_ids",
                             field_data,
                             domain="stock.location.route")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Public Categories
     if field_id == "public_categ_ids":
         M2MHelper.set_ids(self.object,
                           "public_categ_ids",
                           field_data,
                           domain="product.public.category")
         self._in.__delitem__(field_id)
     if field_id == "public_categ":
         M2MHelper.set_names(self.object,
                             "public_categ_ids",
                             field_data,
                             domain="product.public.category")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Website Alternate Products
     if field_id == "alternative_products":
         M2MHelper.set_names(self.object,
                             "alternative_product_ids",
                             field_data,
                             domain="product.template")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Website Alternate Products
     if field_id == "accessory_products":
         M2MHelper.set_names(self.object,
                             "accessory_product_ids",
                             field_data,
                             domain="product.product")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Allowed Companies
     if field_id == "company_ids":
         M2MHelper.set_ids(self.object,
                           "ons_allowed_company_ids",
                           field_data,
                           domain="res.company")
         self._in.__delitem__(field_id)
     if field_id == "company_names":
         M2MHelper.set_names(self.object,
                             "ons_allowed_company_ids",
                             field_data,
                             domain="res.company")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # Product Brand
     if field_id == "product_brand_id":
         M2OHelper.set_id(self.object,
                          "product_brand_id",
                          field_data,
                          domain="product.brand")
         self._in.__delitem__(field_id)
     if field_id == "product_brand":
         M2OHelper.set_name(self.object,
                            "product_brand_id",
                            field_data,
                            domain="product.brand")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # [Point of Sale] POS Category
     if field_id == "pos_categ_id":
         M2OHelper.set_id(self.object,
                          "pos_categ_id",
                          field_data,
                          domain="pos.category")
         self._in.__delitem__(field_id)
     if field_id == "pos_categ":
         M2OHelper.set_name(self.object,
                            "pos_categ_id",
                            field_data,
                            domain="pos.category")
         self._in.__delitem__(field_id)
     # ==================================================================== #
     # [MY LED] Product Tags
     if field_id == "tag_id":
         M2MHelper.set_names(self.object,
                             "tag_ids",
                             '["' + field_data +
                             '"]' if isinstance(field_data, str) else None,
                             domain="product.tag")
         self._in.__delitem__(field_id)
     if field_id == "tag_ids":
         M2MHelper.set_names(self.object,
                             "tag_ids",
                             field_data,
                             domain="product.tag")
         self._in.__delitem__(field_id)