Ir al contenido
Menú
Se marcó esta pregunta
3896 Vistas

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
mar 15
4626
1
abr 22
3651
1
dic 21
2367
1
jul 21
8532
0
dic 24
1323