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.

1

How can pass current id in fields_view_get function?

By
haylahi
on 3/7/13, 2:25 PM 8,677 views

hello,

I need to get current ID or active_id for sales order form in fields_view_get fonction, when click in form. any idea ??? Thks

6

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/7/13, 4:47 PM

Hi,

in python use context as :

id_you_want = context.get('active_id', False) => return id or False

but the form should be saved at leat one time to create id.

to give id of the sale order form to sale order line tree one2many :

in sale order line do :

in xml : ....

<notebook>
<page string="Order Lines">
    <field name="order_line" context="{'order_id': active_id}">
        <form string="Sales Order Lines" version="7.0">
            <field name="order_id">

....

in python :

to get order id as default value, add this in python class sale order line :

_defaults = {
   'order_id': lambda self, cr, uid, context: context.get('order_id', False),}

each time you will click on create button in sale order line, order_id will have id of its parent form.

Bye

1
Ajay
On 5/20/15, 7:55 AM

Hi,

You can't go with fields_view_get function for particular record_id, because fields_view_get will not be called if you navigate through one Sale order form to another.

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: 3/7/13, 2:25 PM
Seen: 8677 times
Last updated: 5/20/15, 7:55 AM