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

In one to many relation each many record having one more one to many relation... how can i show those data(one more one to many

By
Pradeep
on 6/11/14, 7:51 AM 2,827 views
  • Parent Record
  •        (One to many)
  •         Child Record1------>(One to many)-->Child Child Record1
  •                                                                  -->Child Child Record12     
  •          child Record2------>(One to many)-->Child Child Record3
                                                                     -->Child Child Record4

How Can show above structure in opnerp tree and form ....? but Before it is show record count  after clicking it showing record.

1

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 6/11/14, 8:57 AM

The below sample code design based on your requirement.

pyhton code:-

class sample_order(osv.osv):
    _name = "sample.order"
    _columns = {
       'name'    : fields.char('Name',  size=64),
       'order_line': fields.one2many('sample.order', 'line_id', 'Order Lines'),
        }

class sample_order_line(osv.osv):        
    _name = "sample.order.line"
    _columns = {
       'name'    : fields.char('Name',  size=64),
       'order_subline': fields.one2many('sample.order.line', 'subline_id', 'Order Lines'),
       'line_id'       : fields.many2one('sample_order', 'Line'),
        }    
 
class sample_line_subline(osv.osv):
_name = "sample.line.subline"
    _columns = {
       'name'    : fields.char('Name',  size=64),
       'subline_id'       : fields.many2one('sample.order.line', 'Line'),
               }    
             

xml file:-

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    <record id="view_sample_order_form" model="ir.ui.view">
      <field name="name">sample.order.form</field>
      <field name="model">sample.order</field>
      <field name="type">form</field>
      <field name="arch" type="xml">
      <form string="Sample Order">
        <field name="name"/>
        <notebook colspan="4">
          <page string="Order Line">
           <field name="order_line" nolabel="1" colspan="4">
            <form string="Order">
               <field name="name"/>
                <notebook colspan="4">
                   <page string="Sub Line">
                     <field name="order_subline" nolabel="1" colspan="4">
                      <form string="Sub Line">
                         <field name="name"/>
                      </form>
                      <tree string="Sub Line">
                         <field name="name"/>
                      </tree>
                      </field>
                    </page>
                </notebook>
            </form>
            </field>
            </page>    
        </notebook>
        </form>
        </field>
    </record>
    </data>
</openerp>       

 

0
khudrath
On 6/11/14, 9:58 AM

sample.order.line: when i am clicking on sample.order.line it is showing sample.line.subline. But i do want like that it have show while loding the page it self.

In the 1st table self i want the 2nd data (but in another pop up) 

In the 2nd table self i want the 3rd data (but in another pop up) 

i am unable to shar the image, due to site portal bug.

If you are able to give email id so that we can share image of the requiremnt.

 

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: 6/11/14, 7:51 AM
Seen: 2827 times
Last updated: 3/16/15, 8:10 AM