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

How I can get URL parameters?

By
Stefan Reisich
on 4/3/13, 1:16 PM 1,836 views

Hello,

how can I get URL parameters eg. the id in this image programmatically:

image description

I need it for a module. The id is not passed in context so I'm trying this way now...

Thank you very much.

0

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/3/13, 1:27 PM

The ID is one a paramater that you can find everywhere you want. It's passed as parameter to every function. Where you need of it?

I need it here: _columns = { 'stock_real': fields.function(nfx_product_value, type='float', string='Real Stock', multi="product"), }

def nfx_product_value(self, cr, uid, ids, field_names, arg, context=None): need id of product here... (ids has stock_location_ids only...)

Stefan Reisich
on 4/3/13, 1:32 PM

def nfx_product_value(self, cr, uid, ids <--- this is a list with all the id..if there is only 1 id, you can take it with ids[0]

Francesco OpenCode
on 4/3/13, 1:37 PM

no, ids is a list with stock_location ids. I need the product id in this function and the location ids...

Stefan Reisich
on 4/3/13, 1:41 PM

What file and what line have you this code? So I can read it, too..

Francesco OpenCode
on 4/3/13, 1:42 PM
Stefan Reisich
on 4/3/13, 1:47 PM

function test is called and returns location ids. this location ids are passed to the fields complete_name, stock_real and stock_virtual

Stefan Reisich
on 4/3/13, 1:51 PM

If I don't know all the code and the context when is it inserted I can't help you...I'm sorry

Francesco OpenCode
on 4/3/13, 1:53 PM

to calculate the real_stock of the product, I need the id of the location and the product too...

Stefan Reisich
on 4/3/13, 1:54 PM

ok, thank you. that's why I want the id from the url... :-(

Stefan Reisich
on 4/3/13, 1:55 PM

If you print the context, can you see the product_id?

Francesco OpenCode
on 4/3/13, 2:13 PM

no, the product_id is not in the context. I tried add it manually with <field name="stock_real" context="{'product_id': 49}"/> but it don't works.

Stefan Reisich
on 4/3/13, 2:23 PM

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: 4/3/13, 1:16 PM
Seen: 1836 times
Last updated: 3/16/15, 8:10 AM