From 08e1dd8fb345216a405edd24f4ad0ec4c2fdaee3 Mon Sep 17 00:00:00 2001 From: ivan deng Date: Fri, 4 Jan 2019 03:31:34 +0800 Subject: [PATCH] opt putaway --- app_stock_putaway/__manifest__.py | 2 ++ app_stock_putaway/i18n/zh_CN.po | 26 +++++++++++++------ app_stock_putaway/models/__init__.py | 3 +++ app_stock_putaway/models/product_strategy.py | 18 +++++++++++++ .../views/product_putaway_views.xml | 16 ++++++++++++ .../views/stock_location_views.xml | 14 ++++++++++ 6 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 app_stock_putaway/models/product_strategy.py create mode 100644 app_stock_putaway/views/stock_location_views.xml diff --git a/app_stock_putaway/__manifest__.py b/app_stock_putaway/__manifest__.py index 3747bf53..deaf3966 100644 --- a/app_stock_putaway/__manifest__.py +++ b/app_stock_putaway/__manifest__.py @@ -29,12 +29,14 @@ """, 'description': """ 上架策略菜单。 + 每个上架策略只适用于指定位置 广州尚鹏,Sunpop.cn 的odoo模块。 """, 'depends': ['stock'], 'images': [], 'data': [ + 'views/stock_location_views.xml', 'views/product_putaway_views.xml', ], 'demo': [ diff --git a/app_stock_putaway/i18n/zh_CN.po b/app_stock_putaway/i18n/zh_CN.po index 9f736e7e..251acecb 100644 --- a/app_stock_putaway/i18n/zh_CN.po +++ b/app_stock_putaway/i18n/zh_CN.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0+e-20180915\n" +"Project-Id-Version: Odoo Server 12.0+e-20181221\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-11-04 20:04+0000\n" -"PO-Revision-Date: 2018-11-04 20:04+0000\n" +"POT-Creation-Date: 2019-01-03 19:28+0000\n" +"PO-Revision-Date: 2019-01-03 19:28+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,15 +16,25 @@ msgstr "" "Plural-Forms: \n" #. module: app_stock_putaway -#: model:ir.actions.act_window,help:app_stock_putaway.action_product_putaway -msgid "Click to define a new picking type group." -msgstr "点击创建一条新的记录." +#: model:ir.model.fields,field_description:app_stock_putaway.field_product_putaway__location_id +msgid "Location" +msgstr "适用位置" #. module: app_stock_putaway -#: model:ir.ui.view,arch_db:app_stock_putaway.app_view_strock_putaway_tree -msgid "Stock Put Away Strategy" +#: model_terms:ir.actions.act_window,help:app_stock_putaway.action_product_putaway +msgid "Please go to \"Configuration->Warehouse Management->Locations\" to Create a Stock Putaway Strategy." +msgstr "请在 \"配置->仓库管理->位置\" 中创建上架策略" + +#. module: app_stock_putaway +#: model:ir.model,name:app_stock_putaway.model_product_putaway +msgid "Put Away Strategy" msgstr "上架策略" +#. module: app_stock_putaway +#: model_terms:ir.ui.view,arch_db:app_stock_putaway.app_view_strock_putaway_tree +msgid "Stock Put Away Strategy" +msgstr "仓库上架策略" + #. module: app_stock_putaway #: model:ir.actions.act_window,name:app_stock_putaway.action_product_putaway #: model:ir.ui.menu,name:app_stock_putaway.menu_putaway diff --git a/app_stock_putaway/models/__init__.py b/app_stock_putaway/models/__init__.py index 40a96afc..a237ef9c 100644 --- a/app_stock_putaway/models/__init__.py +++ b/app_stock_putaway/models/__init__.py @@ -1 +1,4 @@ # -*- coding: utf-8 -*- + +from . import product_strategy + diff --git a/app_stock_putaway/models/product_strategy.py b/app_stock_putaway/models/product_strategy.py new file mode 100644 index 00000000..6a24616f --- /dev/null +++ b/app_stock_putaway/models/product_strategy.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +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) + + diff --git a/app_stock_putaway/views/product_putaway_views.xml b/app_stock_putaway/views/product_putaway_views.xml index 5998786a..0bd1ee8f 100644 --- a/app_stock_putaway/views/product_putaway_views.xml +++ b/app_stock_putaway/views/product_putaway_views.xml @@ -6,11 +6,27 @@ + + + + app.product.putaway.form + product.putaway + + + + + + + + + + + Stock Putaway Strategy product.putaway diff --git a/app_stock_putaway/views/stock_location_views.xml b/app_stock_putaway/views/stock_location_views.xml new file mode 100644 index 00000000..31b75f2e --- /dev/null +++ b/app_stock_putaway/views/stock_location_views.xml @@ -0,0 +1,14 @@ + + + + app.stock.location.form + stock.location + + + + {'location_id': active_id, 'default_location_id': active_id} + [('location_id','=',active_id)] + + + +