diff --git a/.gitignore b/.gitignore index 3b00dfd4..1c8084a7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ /app_odoo_customize/_resource /app_web_studio /web_studio +/ref .conf .pyc \ No newline at end of file diff --git a/app_stock_report/__init__.py b/app_stock_report/__init__.py new file mode 100644 index 00000000..fa9f002c --- /dev/null +++ b/app_stock_report/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- + +from . import models +from . import ir +from . import res \ No newline at end of file diff --git a/app_stock_report/__openerp__.py b/app_stock_report/__openerp__.py new file mode 100644 index 00000000..6a357e36 --- /dev/null +++ b/app_stock_report/__openerp__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Created on 2017-11-05 +# author: 广州尚鹏,http://www.sunpop.cn +# email: 75695762@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# http://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# http://www.sunpop.cn/odoo10_developer_document_offline/ +# description: + + +{ + 'name': "App Warehouse Management Stock Report", + 'version': '10.0.1', + 'summary': """仓库盘点与报表增强""", + 'description': """ + 扫码面板 + """, + 'author': 'Sunpop.cn', + 'website': 'http://www.sunpop.cn', + 'license': 'LGPL-3', + 'category': 'Warehouse', + 'sequence': 0, + 'price': 98.00, + 'currency': 'EUR', + 'depends': ['stock'], + 'data': [ + 'views/stock_location_views.xml', + 'views/stock_picking_views.xml', + 'views/menus.xml', + ], + 'demo': [ + ], + 'test': [ + ], + 'css': [ + ], + 'qweb': [ + ], + 'js': [ + ], + 'images': [ + ], + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/app_stock_report/i18n/zh_CN.po b/app_stock_report/i18n/zh_CN.po new file mode 100644 index 00000000..57f0fb4e --- /dev/null +++ b/app_stock_report/i18n/zh_CN.po @@ -0,0 +1,74 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * app_stock_report +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e-20180326\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-22 15:54+0000\n" +"PO-Revision-Date: 2018-04-22 15:54+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Current Stock" +msgstr "当前库存" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.app_view_location_form +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "All Move" +msgstr "出入库明细" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.app_stock_picking_type_kanban +msgid "All Move Report" +msgstr "出入库明细" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.app_view_location_form +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Move In" +msgstr "入库明细" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.app_view_location_form +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Move Out" +msgstr "出库明细" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Products" +msgstr "库存产品" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Stock Location" +msgstr "库存位置" + +#. module: app_stock_report +#: model:ir.ui.menu,name:app_stock_report.app_menu_stock_move_report +msgid "Locations" +msgstr "按库位统计" + +#. module: app_stock_report +#: model:ir.actions.act_window,name:app_stock_report.act_move_in_location_open +msgid "Stock Move In" +msgstr "查看入库明细" + +#. module: app_stock_report +#: model:ir.actions.act_window,name:app_stock_report.act_move_out_location_open +msgid "Stock Move Out" +msgstr "查看出库明细" + +#. module: app_stock_report +#: model:ir.ui.view,arch_db:app_stock_report.view_location_kanban +msgid "Recent 30 days" +msgstr "最近 30 天统计" \ No newline at end of file diff --git a/app_stock_report/ir/__init__.py b/app_stock_report/ir/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_stock_report/ir/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_stock_report/models/__init__.py b/app_stock_report/models/__init__.py new file mode 100644 index 00000000..1a82ec3b --- /dev/null +++ b/app_stock_report/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- + +from . import stock_location +from . import stock_picking_type + diff --git a/app_stock_report/models/stock_location.py b/app_stock_report/models/stock_location.py new file mode 100644 index 00000000..d83f1d71 --- /dev/null +++ b/app_stock_report/models/stock_location.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models, api, _ +from datetime import datetime, timedelta +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT + +# 限制时间,数据量不可太大 +DAY_LIMIT = 30 + +class StockLocation(models.Model): + _inherit = "stock.location" + + day_limit = fields.Integer(string=u'Day limit in report dashboard', default=DAY_LIMIT) + + @api.multi + def act_move_all_location_open(self): + self.ensure_one() + location_id = self.id + stime = datetime.now() - timedelta(days=self.day_limit) + stime_str = stime.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + + if location_id: + action = self.env.ref('stock.stock_move_action').read()[0] + action['name'] = "Stock Move All" + action['domain'] = ['&', ('date_expected', '>', stime_str), '|', ('location_dest_id', '=', location_id), ('location_id', '=', location_id)] + action['context'] = {'search_default_done': True} + return action + + @api.multi + def act_move_in_location_open(self): + self.ensure_one() + location_id = self.id + stime = datetime.now() - timedelta(days=self.day_limit) + stime_str = stime.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + if location_id: + action = self.env.ref('stock.stock_move_action').read()[0] + action['name'] = "Stock Move In" + action['domain'] = ['&', ('date_expected', '>', stime_str), ('location_dest_id', '=', location_id)] + action['context'] = {'search_default_done': True} + return action + + @api.multi + def act_move_out_location_open(self): + self.ensure_one() + location_id = self.id + stime = datetime.now() - timedelta(days=self.day_limit) + stime_str = stime.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + if location_id: + action = self.env.ref('stock.stock_move_action').read()[0] + action['name'] = "Stock Move Out" + action['domain'] = ['&', ('date_expected', '>', stime_str), ('location_id', '=', location_id)] + action['context'] = {'search_default_done': True} + return action diff --git a/app_stock_report/models/stock_picking_type.py b/app_stock_report/models/stock_picking_type.py new file mode 100644 index 00000000..83ab9a46 --- /dev/null +++ b/app_stock_report/models/stock_picking_type.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models, api, _ +from datetime import datetime, timedelta +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT + +# 限制时间,数据量不可太大 +DAY_LIMIT = 30 + +class StockPickingType(models.Model): + _inherit = "stock.picking.type" + + @api.multi + def act_move_all_picking_open(self): + self.ensure_one() + picking_id = self.id + stime = datetime.now() - timedelta(days=DAY_LIMIT) + stime_str = stime.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + + if picking_id: + action = self.env.ref('stock.stock_move_action').read()[0] + action['name'] = "Stock Move All" + action['domain'] = ['&', ('date_expected', '>', stime_str), ('picking_type_id', '=', picking_id)] + action['context'] = {'search_default_done': True} + return action + diff --git a/app_stock_report/report/__init__.py b/app_stock_report/report/__init__.py new file mode 100644 index 00000000..633f8661 --- /dev/null +++ b/app_stock_report/report/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- + diff --git a/app_stock_report/res/__init__.py b/app_stock_report/res/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_stock_report/res/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_stock_report/static/description/icon.png b/app_stock_report/static/description/icon.png new file mode 100644 index 00000000..4c57f611 Binary files /dev/null and b/app_stock_report/static/description/icon.png differ diff --git a/app_stock_report/views/menus.xml b/app_stock_report/views/menus.xml new file mode 100644 index 00000000..70a6e04c --- /dev/null +++ b/app_stock_report/views/menus.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/app_stock_report/views/stock_location_views.xml b/app_stock_report/views/stock_location_views.xml new file mode 100644 index 00000000..404c5603 --- /dev/null +++ b/app_stock_report/views/stock_location_views.xml @@ -0,0 +1,133 @@ + + + + app.stock.location.form + stock.location + + + + + +
+ +
+ +
+
+

Recent days

+
+
+ All Move +
+
+ Move In +
+
+ Move Out +
+
+ + + + + + +
+
+ + {# 增加库移透视表#} + + stock.move.pivot + stock.move + + + + + + + + + + + Locations + stock.location + ir.actions.act_window + form + kanban,tree,form + + + {'search_default_in_location':1} + +

+ Click to add a location. +

+ Define your locations to reflect your warehouse structure and + organization. Odoo is able to manage physical locations + (warehouses, shelves, bin, etc), partner locations (customers, + vendors) and virtual locations which are the counterpart of + the stock operations like the manufacturing orders + consumptions, inventories, etc. +

+ Every stock operation in Odoo moves the products from one + location to another one. For instance, if you receive products + from a vendor, Odoo will move products from the Vendor + location to the Stock location. Each report can be performed on + physical, partner or virtual locations. +

+
+
+
diff --git a/app_stock_report/views/stock_picking_views.xml b/app_stock_report/views/stock_picking_views.xml new file mode 100644 index 00000000..231b4dd2 --- /dev/null +++ b/app_stock_report/views/stock_picking_views.xml @@ -0,0 +1,18 @@ + + + + + stock.picking.type.kanban + stock.picking.type + + + + + + + + +