Exemplo n.º 1
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)
Exemplo n.º 2
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)