Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3162 Lượt xem

Hi everybody,


I need help again about a problem of display when i want to show a one2many field in a form.

I try to do a relation between a field I add in purchase order form, with a project module, who ll have the record of one or many purchase order

The relation looks working, I could add it in purchase order, and when i go to my project module and open the project object i selected before in my purchase order, the first line in the tree who should display all purchase order in relation, is cut but clickable, and could open, on click, the right purchase order.


When i go to edit that project, the tree tab display well, and the first line in the tree show no name, a blank case with option to delete it at the end of the line.

When I click on that blank record, I could find the list of PO who's existing in the DB...

I think I forget something but don't know why. Is someone understand it? Let me know if you need more info.


class project(models.Model):
    _name = 'xxxxx.project'
    _description = 'xxxxxx Project Information'
    _rec_name = 'project_seq'

    project_purchase_order = fields.One2many('purchase.order', 'purchase_project_id', string="Purchase Order #")
       
   
class purchase(models.Model):
    _inherit = 'purchase.order'
   
    purchase_project_name = fields.Many2one('purchase.order', string="List of Purchase order #", required=True, index=True)
    purchase_project_id = fields.Many2one('xxxxx.project', string="Project #")


    and my view:

...
            <notebook colspan="3">
              <page string="Purchase Documents" autofocus="autofocus">
                    <group string="Purchase Order" name="no_purchase_order" priority="1">
                      <field name="project_purchase_order">
                         <tree editable="bottom">
                           <field name="purchase_project_name"/>
                           <field name="purchase_project_id" invisible="1"/>
                         </tree>
                      </field>
                    </group>
              </page>

....

Screenshot:

https://cloudx.rtzevenement.fr/index.php/s/Di4xMgbZTxLc2fj

Ảnh đại diện
Huỷ bỏ

try to set name field

Câu trả lời hay nhất

Hello @jeff,

I think you didn't have managed code for  'project_seq' of 'xxxxx.project' at the time of creation please check once

If you have set, could you please share that code here?


Can you please try this, 

<page string="Purchase Documents" autofocus="autofocus">

  <field name="project_purchase_order">

    <tree editable="bottom">

        <field name="purchase_project_name"/>

        <field name="purchase_project_id" invisible="1"/>

    </tree>

  </field>

</page>

Regards,




Email:     odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 22
132
0
thg 3 16
3411
0
thg 3 15
3823
2
thg 5 25
2309
1
thg 10 23
5262