Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1377 Widoki

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

       

       

           

               

                

               

                   

                  

                    

               

           

       

       

   

   


Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

I tried it, but it didn't work.

Powiązane posty Odpowiedzi Widoki Czynność
1
sty 24
1081
1
sty 24
1173
2
sty 24
1209
1
maj 25
1001
0
maj 25
592