跳至内容
菜单
此问题已终结
4035 查看

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.

形象
丢弃
相关帖文 回复 查看 活动
2
3月 15
4689
1
4月 22
3773
1
12月 21
2452
1
7月 21
8613
0
12月 24
1411