It is currently Sun Feb 12, 2012 8:26 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: how inherit of a form with <field mode=form,tree,graph
PostPosted: Tue Mar 02, 2010 10:07 am 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
Hi,
I read and know how to inherit for a xlm file.
But I have a little problem to inherit of a form which include in the same record form tree and graph.
example :

in sale_view.xml, line 114 :
Code:
field colspan="4" mode="tree,form,graph" name="order_line" nolabel="1" widget="one2many_list"


Thanks for a little help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 10:22 am 
Offline

Joined: Tue Aug 14, 2007 4:08 pm
Posts: 360
Hello,
I've exactly the same problem. Trying since yesterday to add a field inside the tree mode but impossible.
I succeed adding a field on the form mode but impossible to add in the tree mode.

to add in the form mode, I just did the following (I wanted to add a field on the top of the page of the notebook)

...
<field name="model">sale.order</field>
<field name="type">form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<separator string="Automatic Declaration" position="before">
<field name="My_New_Field" />
</separator>
</field>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 10:48 am 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
Hi Fostera,
thanks for your answer, I spend the same time as you for this, and I tried all combination possible (even use separator) ..., exept the good !!!!
The reason for this post.
The question, it is possible ? :shock:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 11:13 am 
Offline

Joined: Tue Aug 14, 2007 4:08 pm
Posts: 360
I found it !!!

Here's the way :

...
<field name="type">form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="priority" eval="50"/>
<field name="arch" type="xml">
<tree string="Sales order lines" position="replace">
<tree string="Sales order lines">
<field colspan="4" name="name"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM"/>
<field name="My_new_field_01"/>
<field name="My_new_field_02"/>
<field name="discount"/>
<field name="price_unit"/>
<field name="price_net"/>
<field name="price_subtotal"/>
</tree>
</tree>
</field>
</record>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 11:18 am 
Offline

Joined: Tue Aug 14, 2007 4:08 pm
Posts: 360
the only problem remains the inheritence. Because of the tree is fully recomposed, the intherited views won't wok anymore...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 11:30 am 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
I already added a field on the right of subtotal, and is added for each line I added.
my problem is : when I do edit a new record, I don't have the field added in the wizard "invoice client".

record id="nan_product_pack_form" model="ir.ui.view">
field name="sale.order.form"</field>
field name="model">sale.order</field>
field name="type">form</field>
field name="inherit_id" ref="sale.view_order_form"/>
field name="arch" type="xml">
notebook>
page string="Order Line">
field name="new_field"/>
/page>
/notebook>
/field>
/record>

record id="nan_product_pack_form" model="ir.ui.view">
field name="sale.order.form"</field>
field name="model">sale.order</field>
field name="type">tree</field>
field name="inherit_id" ref="sale.view_order_form"/>
field name="arch" type="xml">
tree string="Sales order lines"
field name="new_field"
/tree>
/field
/record>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 11:56 am 
Offline

Joined: Tue Aug 14, 2007 4:08 pm
Posts: 360
for me, everything is working, whe I edit a line, my new fields are coming in the wizard.

I exactly made what I inserted in my precedent post. I noticed in your last post that you wrote :

record id="nan_product_pack_form" model="ir.ui.view">
field name="sale.order.form"</field>
field name="model">sale.order</field>
field name="type">tree</field>
field name="inherit_id" ref="sale.view_order_form"/>

for me, the field name = "type">tree</field> is wrong and should be form.

Beside that, if you inherit in the same way I wrote, this should work. It's working fine for me now


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 3:27 pm 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
for me, the field name = "type">tree</field> is wrong and should be form.


Yes I know, but with this two record in my file xml (it works like yours), I have the same result than your solution.
when I clic edit a new record, in view named "openerp link invoice line", the field is not in Manual description" even with your code (object for the field is type boolean).

If I had in sale_view directly in :
separator colspan="4" string="Manual Description" for the form
and
tree string="Sales order lines" for the tree
no problem.


???


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2010 4:52 pm 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
in fact my solution works just with client gtk, not in web client.
but always impossible to add the new field in page string="Order Line".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2010 4:56 pm 
Offline
OpenERP Developer

Joined: Sun Mar 23, 2008 12:41 pm
Posts: 138
Location: Grand-Rosiere
You can use an SQL file in your update_xml section and override the value

Code:
update ir_ui_view set type='form' where id in (select res_id from ir_model_data where model='ir.ui.view' and name='nan_product_pack_form')

_________________
OpenERP Developer


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2010 8:04 pm 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
Hi Ste.Wi.
thank you very much for your reply and spend time,
I created a file .sql with your request inside (written with differnet forms = ', ", ...), add the name of the file in update_xml,
but when I want to install the module, I have an error "ProgrammingError: syntax error at or near "UPDATE"
LINE 1: UPDATE ir_ui_view SET type = 'form' WHERE id IN ( SELECT re...".

Sorry, if you have another proposition, ot think to what I do bad ...
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2010 3:21 pm 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
HI Ste.Wi,
I forgot to say it works well, just put the good name for name='nan_product_pack_form'
Thanks for this solution.
Bye


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2010 12:36 pm 
Offline
OpenERP Developer

Joined: Sun Mar 23, 2008 12:41 pm
Posts: 138
Location: Grand-Rosiere
Can I see the sql file ?

_________________
OpenERP Developer


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP