Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1376 Vistas

I have added a page inside crm which contains 2 fields: product info and image.Whenever I try to select a product, another new page pop up and it want me to select from there.But I want select it inline option. I have tried many ways but nothing worked. What I need to do?
Here is my code:
.py:
from odoo import models, fields, api

class CrmLead(models.Model):

    _inherit = 'crm.lead'

 

    product_ids = fields.many2many('product.product', string='Products', edit="inline")

    combined_info = fields.Char(string='Product Info', compute='_compute_combined_info')

    def _compute_combined_info(self):

        for product in self:

            product.combined_info = f"{product.default_code} - {product.name}"

class ProductImage(models.Model):

    _inherit = 'product.product'

    _description = 'Product Image'

 

    product_image = fields.Binary(string='Design')

    combined_info = fields.Char(string='Product Info', compute='_compute_combined_info')

 

    def _compute_combined_info(self):

        for product in self:

            product.combined_info = f"{product.default_code} - {product.name}"


 .xml:

   

        wise.crm.lead.form.inherit

        crm.lead

       

       

           

               

                

               

                   

                  

                    

               

           

       

       

   

   


Avatar
Descartar
Mejor respuesta

Hi,


You can give editable="bottom" in the tree view.

Here's an example you could follow:

<field name="combo_ids" widget="one2many" >
   <tree string="combos" editable="bottom">
      <field name="sequence" widget="handle"/>
      <field name="name" />
      <field name="base_price" />
      <field name="num_of_products"/>
   </tree>
</field>


Hope it helps

Avatar
Descartar
Autor

I tried it, but it didn't work.

Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 24
1078
1
ene 24
1172
2
ene 24
1209
1
may 25
999
0
may 25
590