Odoo Help

0

What is the best way to lookup things from within a model?

By
Darrel
on 11/28/14, 2:58 PM 737 views

I need to collect information about an order after a stock.move is created.

So far I have this:

    def create(self, cr, uid, vals, context=None):
        new_id = super(stock_move, self).create(cr, uid, vals, context=context)

        params = {}
        params['order_number'] = 0
        params['shipment_id'] = 0
        params['sku'] = vals['product_id']
        params['qty'] = vals['product_qty']
        params['weight'] = 0
        params['value'] = 0
        params['address'] = 0
        params['email'] = 0

What I don't know is, a) How do I query for the missing pieces? order number, shipment id, weight, value, customer address and email

and b) Which models are storing these things?

 

I've been looking into this, by looking at the helper methods used by other models. I understand I can use

self.pool.get('MODEL_NAME') for many things, but am unclear on how to do lookups by based on the relations. I can see that stock.move has many2one relationships with, stock.location (for instance), which I could use to get the 'address' part of the data I need, but am not sure how to get the related object and it's values.

 

Any help would be appreciated.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/28/14, 2:58 PM
Seen: 737 times
Last updated: 3/16/15, 8:10 AM