Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

One2many inverse field

By
Segun Adesanya
on 1/27/16, 12:09 PM 446 views

Im stuck on a one2many inverse field to add new lines into my one2many fields. I will appreciate any help i can get.

The one2many is a computed field already, so i am trying to use inverse to add new lines into this field. Presently what it does is to just allow the already existing fields to be edited

Segun Adesanya
on 1/28/16, 4:21 AM

@api.one def accumulate_files(self): documents = self.env['document.customer'] document_gotten = documents.search([('name','=', self.name)]) for docs in document_gotten: self.res_line_ids |= docs.customer_line_ids @api.one def edit_accumulate_files(self): documents = self.env['document.customer'] for lines in documents.customer_line_ids: lines.write(self.res_line_ids)

Segun Adesanya
on 1/28/16, 4:52 AM
0
Dr Obx
On 1/27/16, 1:58 PM

Code please ;)

What is the problem ?

class class_one()

_name = 'class.one'

 _columns = {

'your_one2many_field': fields.one2many('class.two','field_m2o_from_class_two', string="Field name"),

}


class class_two()

  _name = 'class.two'  

_columns = {

'your_field_many2one': fields.many2one('class.one', 'Name'),

......

other fields you want in tree

}


view:

<group name="sold">

<field name="your_one2many_field">

<tree>

<field name="field 1 from class_two"/>

<field name="field 2 from class_two"/>

<field name="field 3 from class_two"/>

<field name="field 4 from class_two"/>

<field name="field 5 from class_two"/>

<field name="field 6 from class_two"/>

"/>

</tree>

</field>

should be ok ;)


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/27/16, 12:09 PM
Seen: 446 times
Last updated: 1/27/16, 1:58 PM