Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3971 Zobrazení

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
bře 15
4656
1
dub 22
3713
1
pro 21
2402
1
čvc 21
8571
0
pro 24
1340