How to get Product name with single Attribute e.g: Product1(color)

Multi tool use
Multi tool use












0














Req is i have created a Product called Product1 and i have given 2 attributes for that i.e. color,fitting,size.



I have defined a field in sale.order



product_id = fields.Many2one('product.product', string="Product")


As per the standard we are getting Product1(color,fitting,size)



My req is i need to get only one attribute i.e. Product1(color)



I tried to do override in name_get function it is not getting. Can anyone help?



Thanks in advance










share|improve this question



























    0














    Req is i have created a Product called Product1 and i have given 2 attributes for that i.e. color,fitting,size.



    I have defined a field in sale.order



    product_id = fields.Many2one('product.product', string="Product")


    As per the standard we are getting Product1(color,fitting,size)



    My req is i need to get only one attribute i.e. Product1(color)



    I tried to do override in name_get function it is not getting. Can anyone help?



    Thanks in advance










    share|improve this question

























      0












      0








      0







      Req is i have created a Product called Product1 and i have given 2 attributes for that i.e. color,fitting,size.



      I have defined a field in sale.order



      product_id = fields.Many2one('product.product', string="Product")


      As per the standard we are getting Product1(color,fitting,size)



      My req is i need to get only one attribute i.e. Product1(color)



      I tried to do override in name_get function it is not getting. Can anyone help?



      Thanks in advance










      share|improve this question













      Req is i have created a Product called Product1 and i have given 2 attributes for that i.e. color,fitting,size.



      I have defined a field in sale.order



      product_id = fields.Many2one('product.product', string="Product")


      As per the standard we are getting Product1(color,fitting,size)



      My req is i need to get only one attribute i.e. Product1(color)



      I tried to do override in name_get function it is not getting. Can anyone help?



      Thanks in advance







      odoo odoo-11 odoo-12






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '18 at 3:03









      iam supreeth

      305212




      305212
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You need product name in sale_order product id field for that you have to override name_saerch method. In many2one field it always call name_search method.
          Thanx






          share|improve this answer





















          • thanks for the reply.. can you please help me out in tat?
            – iam supreeth
            Dec 28 '18 at 6:06










          • name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
            – Akshay
            Dec 30 '18 at 6:57










          • def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
            – Akshay
            Dec 30 '18 at 6:58












          • You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
            – Akshay
            Dec 30 '18 at 6:58











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53953222%2fhow-to-get-product-name-with-single-attribute-e-g-product1color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You need product name in sale_order product id field for that you have to override name_saerch method. In many2one field it always call name_search method.
          Thanx






          share|improve this answer





















          • thanks for the reply.. can you please help me out in tat?
            – iam supreeth
            Dec 28 '18 at 6:06










          • name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
            – Akshay
            Dec 30 '18 at 6:57










          • def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
            – Akshay
            Dec 30 '18 at 6:58












          • You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
            – Akshay
            Dec 30 '18 at 6:58
















          1














          You need product name in sale_order product id field for that you have to override name_saerch method. In many2one field it always call name_search method.
          Thanx






          share|improve this answer





















          • thanks for the reply.. can you please help me out in tat?
            – iam supreeth
            Dec 28 '18 at 6:06










          • name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
            – Akshay
            Dec 30 '18 at 6:57










          • def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
            – Akshay
            Dec 30 '18 at 6:58












          • You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
            – Akshay
            Dec 30 '18 at 6:58














          1












          1








          1






          You need product name in sale_order product id field for that you have to override name_saerch method. In many2one field it always call name_search method.
          Thanx






          share|improve this answer












          You need product name in sale_order product id field for that you have to override name_saerch method. In many2one field it always call name_search method.
          Thanx







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 28 '18 at 5:24









          Akshay

          262




          262












          • thanks for the reply.. can you please help me out in tat?
            – iam supreeth
            Dec 28 '18 at 6:06










          • name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
            – Akshay
            Dec 30 '18 at 6:57










          • def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
            – Akshay
            Dec 30 '18 at 6:58












          • You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
            – Akshay
            Dec 30 '18 at 6:58


















          • thanks for the reply.. can you please help me out in tat?
            – iam supreeth
            Dec 28 '18 at 6:06










          • name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
            – Akshay
            Dec 30 '18 at 6:57










          • def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
            – Akshay
            Dec 30 '18 at 6:58












          • You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
            – Akshay
            Dec 30 '18 at 6:58
















          thanks for the reply.. can you please help me out in tat?
          – iam supreeth
          Dec 28 '18 at 6:06




          thanks for the reply.. can you please help me out in tat?
          – iam supreeth
          Dec 28 '18 at 6:06












          name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
          – Akshay
          Dec 30 '18 at 6:57




          name_search method returns the name of the model.you can override name_search method and returns the name of the product according to your requirement .
          – Akshay
          Dec 30 '18 at 6:57












          def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
          – Akshay
          Dec 30 '18 at 6:58






          def name_search(self, name='', args=None, operator='ilike', limit=100): vehicle_name= super(Vehicle, self).name_search(name=name, args=args, operator=operator, limit=limit) args += [('vehicle_no', operator, name)] vehicles_no = self.env['fleet.vehicle'].search(args) for vehicle in vehicles_no: if (vehicle.id, vehicle.name) not in vehicle_name: vehicle_name.append((vehicle.id, vehicle.name)) return vehicle_name
          – Akshay
          Dec 30 '18 at 6:58














          You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
          – Akshay
          Dec 30 '18 at 6:58




          You can see in my example i added searching of vehicle according to vehicle_no also and return the whole vehicle name at last. It will also search vehicle no in it and it will get whole name of vehicle with vehicle no also.You also have to add or remove your colour or size in your ptoduct name so that in sale order page you will get your product name with size, colour or anything
          – Akshay
          Dec 30 '18 at 6:58


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53953222%2fhow-to-get-product-name-with-single-attribute-e-g-product1color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          R,A,m2VJ4QTJWI rT QC 51Xb,JyX G1tbdcgTvGmi9a2gO l9T7jwS dZvpJfcDxmPu GyPRVnTb1rD8 xR1i G GM,cza7 yLxrlwp0
          WzU,Giqjj,g,KqsqQ6,a qA6Hh zyg,2

          Popular posts from this blog

          Monofisismo

          compose and upload a new article using a custom form

          “attempting to read past stream EOM” using Sybase.AdoNet4.AseClient