Files
app-odoo/app_stock_putaway/models/product_strategy.py
2019-06-10 05:36:45 +08:00

18 lines
429 B
Python

# -*- coding: utf-8 -*-
from odoo import fields, models, api
class PutAwayStrategy(models.Model):
_inherit = 'product.putaway'
# 增加默认父位置
location_id = fields.Many2one('stock.location', 'Location')
@api.model
def create(self, vals):
location_id = self.env.context.get('location_id')
vals['location_id'] = location_id
return super(PutAwayStrategy, self).create(vals)