add app_purchase

This commit is contained in:
ivan deng
2018-02-14 18:04:31 +08:00
parent 6fce3d4331
commit 79961b39ad
32 changed files with 992 additions and 1 deletions

View File

@@ -9,7 +9,7 @@
<a class="btn btn-primary mb16" href="https://www.odoo.com/apps/modules/10.0/app_ui_enhance/">App UI enhance</a>
</h1>
<br>
<h3>Lastest update: v10.0.2.1, 2018-02-01
<h3>Lastest update: v10.0.2.4, 2018-02-04</h3>
<ul>
<li>1. Deletes Odoo label in footer</li>
<li>2. Replaces "Odoo" in Windows title</li>

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from hooks import pre_init_hook
from . import models
from . import res
from . import wizard

View File

@@ -0,0 +1,66 @@
# -*- 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 Purchase Batch Procurement, Procurement product set supplier",
'version': '10.0.2.14',
'summary': """App Purchase Batch Procurement, Procurement product set supplier""",
'description': """
1. Product batch reorder, create procurement
产品批量补货
2. Procurement batch setup supplier, quick purchase
补货单快速设置供应商,直接生成采购询价单。
3. Product filter virtual view (available/exhausted/negative)
产品在途库存过滤
4. Multi language support, done for Chinese and English
多语言版本,默认支持中英双语
""",
'author': 'Sunpop.cn',
'website': 'http://www.sunpop.cn',
'license': 'LGPL-3',
'category': 'Purchase',
'sequence': 0,
'pre_init_hook': 'pre_init_hook',
'depends': ['base', 'stock', 'purchase'],
'data': [
'views/asset_views.xml',
'views/procurement_order_views.xml',
'views/product_template_views.xml',
'views/menus.xml',
'wizard/product_set_supplier_views.xml',
'wizard/procurement_batch_generator_view.xml',
],
'demo': [
],
'test': [
],
'css': [
],
'qweb': [
'static/src/xml/tree_view_btn.xml'
],
'js': [
],
'images': [
],
"price": 68.00,
"currency": "EUR",
'installable': True,
'auto_install': False,
'application': True,
}

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Created on 2017-11-22
# author: 广州尚鹏http://www.sunpop.cn
# email: 300883@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:
def pre_init_hook(cr):
"""
数据初始化,只在安装时执行,更新时不执行
"""
try:
pass
except Exception, e:
raise Warning(e)

View File

@@ -0,0 +1,305 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * app_purchase_batch_procurement
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20171107\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-14 10:00+0000\n"
"PO-Revision-Date: 2018-02-14 10:00+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_purchase_batch_procurement
#: code:addons/app_purchase_batch_procurement/wizard/procurement_batch_generator.py:73
#, python-format
msgid "All requested quantities are null."
msgstr "没有要补货的产品,请检查."
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.procurement_batch_generator_wiz_form
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.product_set_supplier_wiz_form
msgid "Cancel"
msgstr "取消"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_company_id
msgid "Company"
msgstr "公司"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_create_uid
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_create_uid
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_create_uid
msgid "Created by"
msgstr "创建人"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_create_date
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_create_date
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_create_date
msgid "Created on"
msgstr "创建时间"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_currency_id
msgid "Currency"
msgstr "币种"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_delay
msgid "Delivery Lead Time"
msgstr "交货周期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_display_name
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_display_name
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_display_name
msgid "Display Name"
msgstr "显示名称"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_date_end
msgid "End Date"
msgstr "结束日期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_date_end
msgid "End date for this vendor price"
msgstr "此供应商价格的结束日期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_virtual_available
msgid "Forecast Quantity"
msgstr "预测数量"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_id
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_id
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_id
msgid "ID"
msgstr "ID"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_outgoing_qty
msgid "Incoming Quantity"
msgstr "将入库"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator___last_update
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line___last_update
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz___last_update
msgid "Last Modified on"
msgstr "最后修改日"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_write_uid
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_write_uid
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_write_uid
msgid "Last Updated by"
msgstr "最后更新人"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_write_date
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_write_date
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_write_date
msgid "Last Updated on"
msgstr "最后更新时间"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_delay
msgid "Lead time in days between the confirmation of the purchase order and the receipt of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."
msgstr "提前时间是订单确认到仓库收到货物天数,使用于采购单自动计算规划调度"
#. module: app_purchase_batch_procurement
#: model:ir.model,name:app_purchase_batch_procurement.model_procurement_batch_generator_line
msgid "Lines of the wizard to request procurements"
msgstr "即将生成补货单的产品"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_min_qty
msgid "Minimal Quantity"
msgstr "最少数量"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_incoming_qty
msgid "Outgoing Quantity"
msgstr "将出库"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_parent_id
msgid "Parent"
msgstr "上级"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_date_planned
msgid "Planned Date"
msgstr "计划的日期"
#. module: app_purchase_batch_procurement
#: code:addons/app_purchase_batch_procurement/wizard/product_set_supplier_wiz.py:59
#, python-format
msgid "Please select valid procurement orders. Only the 'status=Exception' and 'Buy in Inventory Routes' product can be set!"
msgstr "请选择有效的补货单。 只有 状态=异常 且 路线包含 '购买' 的 '可购买' 产品才可设置!"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_route_ids
msgid "Preferred Routes"
msgstr "首选路线"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_price
msgid "Price"
msgstr "价格"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_ids
msgid "Procurement Request Lines"
msgstr "补货明细"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.product_set_supplier_wiz_form
msgid "Procurement list to setup supplier for the product"
msgstr "待设置产品供应商的补货单"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_p_ids
msgid "Procurement to set"
msgstr "待处理的补货单"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_product_id
msgid "Product"
msgstr "产品"
#. module: app_purchase_batch_procurement
#: model:ir.actions.act_window,name:app_purchase_batch_procurement.purchase_procurement_action
#: model:ir.ui.menu,name:app_purchase_batch_procurement.felive_menu_purchase_procurement_action
msgid "Purchase Procurement Orders"
msgstr "待处理的采购补货"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_qty_available
msgid "Quantity On Hand"
msgstr "在手数量"
#. module: app_purchase_batch_procurement
#. openerp-web
#: code:addons/app_purchase_batch_procurement/static/src/xml/tree_view_btn.xml:8
#: model:ir.actions.act_window,name:app_purchase_batch_procurement.procurement_batch_generator_tree_action
#: model:ir.actions.act_window,name:app_purchase_batch_procurement.procurement_batch_generator_tree_action2
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.procurement_batch_generator_wiz_form
#, python-format
msgid "Request Procurements"
msgstr "补货请求"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_procurement_qty
msgid "Requested Quantity"
msgstr "补货数量"
#. module: app_purchase_batch_procurement
#. openerp-web
#: code:addons/app_purchase_batch_procurement/static/src/xml/tree_view_btn.xml:5
#: model:ir.actions.act_window,name:app_purchase_batch_procurement.action_product_set_supplier
#: model:ir.actions.act_window,name:app_purchase_batch_procurement.product_set_supplier_action
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.product_set_supplier_wiz_form
#, python-format
msgid "Set Supplier"
msgstr "设置供应商并创建采购询价单"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.product_set_supplier_wiz_form
msgid "Set supplier and run Scheduler"
msgstr "设定供应商并执行补货计算"
#. module: app_purchase_batch_procurement
#: model:ir.model,name:app_purchase_batch_procurement.model_product_set_supplier_wiz
msgid "Set supplier for product"
msgstr "指定相关产品模板的供应商"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_view_po
msgid "Show relate RFQ after set supplier"
msgstr "完成后编辑相关采购询价单"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_date_start
msgid "Start Date"
msgstr "开始日期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_date_start
msgid "Start date for this vendor price"
msgstr "此供应商价格的开始日期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_partner_id
msgid "Supplier"
msgstr "供应商"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_min_qty
msgid "The minimal quantity to purchase from this vendor, expressed in the vendor Product Unit of Measure if not any, in the default unit of measure of the product otherwise."
msgstr "从供应商采购的最小数量的计量单位在产品的供应商信息中有维护,如果没有维护,那么计量单位就是产品中默认设置的"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_price
msgid "The price to purchase a product"
msgstr "该价格购买产品"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_uom_id
msgid "Unit of Measure"
msgstr "计量单位"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.procurement_batch_generator_wiz_form
msgid "Validate"
msgstr "确定"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.product_set_supplier_wiz_form
msgid "Validity From"
msgstr "有效期"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_product_set_supplier_wiz_name
msgid "Vendor"
msgstr "供应商"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,help:app_purchase_batch_procurement.field_product_set_supplier_wiz_name
msgid "Vendor of this product"
msgstr "这个产品的供应商"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.felive_product_template_search_form_view_stock
msgid "Virtual Available Products"
msgstr "在途库存>0"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.felive_product_template_search_form_view_stock
msgid "Virtual Exhausted Stock"
msgstr "在途库存=0"
#. module: app_purchase_batch_procurement
#: model:ir.ui.view,arch_db:app_purchase_batch_procurement.felive_product_template_search_form_view_stock
msgid "Virtual Negative Stock"
msgstr "在途库存<0"
#. module: app_purchase_batch_procurement
#: model:ir.model.fields,field_description:app_purchase_batch_procurement.field_procurement_batch_generator_line_warehouse_id
msgid "Warehouse"
msgstr "仓库"
#. module: app_purchase_batch_procurement
#: model:ir.model,name:app_purchase_batch_procurement.model_procurement_batch_generator
msgid "Wizard to create procurements from product tree"
msgstr "补货向导"

View File

@@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1 @@
# -*- coding: utf-8 -*-

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -0,0 +1,111 @@
<section class="oe_container">
<div class="oe_row oe_spaced" style="max-width: 800px;">
<div class="oe_span12">
<h2 class="oe_slogan">App Odoo Customize</h2>
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
<p>This moduld is to easy purchase</p>
<h3>Lastest update: v10.0.2.14, 2018-02-14</h3>
<ul>
<li>1. Product batch reorder, create procurement</li>
<li>2. Procurement batch setup supplier, quick purchase</li>
<li>3. Product filter virtual view (available/exhausted/negative), and auto set procurement quantity</li>
</ul>
</div>
<div class="oe_demo oe_screenshot">
<img src="cnreadme.png" style="border:1px solid black"/>
<br/>
</div>
</div>
</div>
<div class="oe_row oe_spaced" style="max-width: 800px;">
<div class="oe_demo"
style="margin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
<h2 class='oe_mt32'>1. Procurement batch setup supplier, quick purchase</h2>
</div>
<div class="oe_demo oe_screenshot">
<img src="demo11.png" style="border:1px solid black"/>
<br/>
<img src="demo12.png" style="border:1px solid black"/>
<br/>
</div>
<div class="oe_demo"
style="margin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
<h2 class='oe_mt32'>Multi-language support: Chinese ready</h2>
</div>
<div class="oe_demo oe_screenshot">
<img src="demo11.png" style="border:1px solid black"/>
</br>
<img src="demo12.png" style="border:1px solid black"/>
<br/>
<h4> So you can get the procurement</h4>
<img src="demo31.png" style="border:1px solid black"/>
<br/>
</div>
</div>
<div class="oe_row oe_spaced" style="max-width: 800px;">
<div class="oe_demo"
style=" argin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%; ">
<h2 class='oe_mt32'>2. Procurement batch setup supplier, quick purchase</h2>
</div>
<div class="oe_demo oe_screenshot">
<img src="demo41.png" style="border:1px solid black"/>
</br>
<img src="demo51.png" style="border:1px solid black"/>
<br/>
<h4> So you can get the purchase of all product</h4>
<img src="demo61.png" style="border:1px solid black"/>
<br/>
<br/>
</div>
</div>
<div class="oe_row oe_spaced" style="max-width: 800px;">
<div class="oe_demo"
style=" argin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%; ">
<h2 class='oe_mt32'>3. Product filter virtual view (available/exhausted/negative), and auto set procurement quantity</h2>
</div>
<div class="oe_demo oe_screenshot">
<img src="demo71.png" style="border:1px solid black"/>
</br>
<h4> The procurement quantity would be auto set</h4>
<img src="demo81.png" style="border:1px solid black"/>
<br/>
</div>
</div>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Technical Help & Support</h2>
</div>
<div class="col-md-12 pad0">
<div class="oe_mt16">
<p><h4>
For any type of technical help & support requests, Feel free to contact us</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
<p><h4>
Via QQ: 300883</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> 300883@qq.com</a>
</div>
<div class="oe_mt16">
<p><h4>
Visit our website for more support.</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="http://www.sunpop.cn" target="_blank"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-web"></i>http://www.sunpop.cn</a>
</div>
</div>
</div>
</section>

View File

@@ -0,0 +1,66 @@
odoo.define('app_purchase_batch_procurement.btn_set_supplier', function (require) {
"use strict";
var core = require('web.core');
var ListView = require('web.ListView');
var web_client = require('web.web_client')
var QWeb = core.qweb;
ListView.include({
render_buttons: function ($node) {
if ($node) {
var self = this;
this._super($node);
this.$buttons.find('.o_list_btn_set_supplier').click(this.proxy('set_supplier_action'));
this.$buttons.find('.o_list_btn_batch_procurement').click(this.proxy('batch_procurement_action'));
}
},
set_supplier_action: function () {
//纯js取
// var active_ids = $.map($('.o_list_view .o_list_record_selector :checkbox:checked'), function (el) {
// return $(el).closest('tr').data('id');
// });
//odoo内置方法取值
var active_ids = this.groups.get_selection().ids
this.do_action({
type: "ir.actions.act_window",
name: " Set Supplier",
res_model: "product.set.supplier.wiz",
views: [[false, 'form']],
view_type: 'form',
view_mode: 'form',
multi: 1,
key2: "client_action_multi",
src_model: "procurement.order",
active_model: "procurement.order",
target: 'new',
context: {'active_ids': active_ids}
});
return {'type': 'ir.actions.client'}
},
batch_procurement_action: function () {
// var active_ids = self.$.map($('.o_list_view .o_list_record_selector :checkbox:checked'), function (el) {
// return $(el).closest('tr').data('id');
// });
var active_ids = this.groups.get_selection().ids
// var active_ids = self.getSelection().ids;
this.do_action({
type: "ir.actions.act_window",
name: "Request Procurements",
res_model: "procurement.batch.generator",
views: [[false, 'form']],
view_type: 'form',
view_mode: 'form',
multi: 1,
key2: "client_action_multi",
src_model: "product.product",
active_model: "product.product",
target: 'new',
context: {'active_ids': active_ids}
});
return {'type': 'ir.actions.client'}
}
});
});

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<button t-if="widget.model == 'procurement.order'" class="btn btn-primary btn-sm o_list_btn_set_supplier" type="button">
Set Supplier
</button>
<button t-if="widget.model == 'product.product' | widget.model == 'product.template'" class="btn btn-primary btn-sm o_list_btn_batch_procurement" type="button">
Request Procurements
</button>
</t>
</t>
</templates>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_backend" name="felive_purchase asset " inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/app_purchase_batch_procurement/static/src/js/btn_set_supplier.js"></script>
</xpath>
</template>
</data>
</odoo>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!--采购补货异常-->
<menuitem id="felive_menu_purchase_procurement_action" action="purchase_procurement_action" parent="purchase.menu_procurement_management"
sequence="10"/>
</data>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="purchase_procurement_action" model="ir.actions.act_window">
<field name="name">Purchase Procurement Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('rule_id.action', '=', 'buy')]</field>
<field name="context">{'search_default_exceptions': 1}</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- search继承spu -->
<record id="felive_product_template_search_form_view_stock" model="ir.ui.view">
<field name="name">felive.product.template.search.stock.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.product_template_search_form_view_stock"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='real_stock_negative']" position="after">
<separator/>
<filter name="virtual_stock_available" string="Virtual Available Products" domain="[('virtual_available','&gt;',0)]"/>
<filter name="virtual_stock_exhausted" string="Virtual Exhausted Stock" domain="[('virtual_available','&lt;=',0),('type','not in',('service', 'consu'))]"/>
<filter name="virtual_stock_negative" string="Virtual Negative Stock" domain="[('virtual_available','&lt;',0)]"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import product_set_supplier_wiz
from . import procurement_batch_generator

View File

@@ -0,0 +1,129 @@
# -*- encoding: utf-8 -*-
from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import Warning
from datetime import datetime, timedelta
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
class ProcurementBatchGenerator(models.TransientModel):
_name = 'procurement.batch.generator'
_description = 'Wizard to create procurements from product tree'
route_ids = fields.Many2many('stock.location.route', string='Preferred Routes')
line_ids = fields.One2many(
'procurement.batch.generator.line', 'parent_id',
string='Procurement Request Lines')
@api.model
def default_get(self, fields):
res = super(ProcurementBatchGenerator, self).default_get(fields)
assert isinstance(self.env.context['active_ids'], list),\
"context['active_ids'] must be a list"
line_ids = []
warehouses = self.env['stock.warehouse'].search(
[('company_id', '=', self.env.user.company_id.id)])
warehouse_id = warehouses and warehouses[0].id or False
# product.template是被继承的所以用同样方法即可
for product in self.env['product.product'].browse(
self.env.context['active_ids']):
# todo: 库存的数量在此使用会导致运算量较大,停用。 如需要再加。未来可以考虑数据全部从前端送过来,不需再查数据库
# partner_id = product.seller_ids and product.seller_ids[0].id or False
if product.virtual_available < 0:
procurement_qty = product.virtual_available * -1
else:
procurement_qty = 1
line_ids.append([0, 0, {
'name': product.name,
'product_id': product.id,
# 'partner_id': partner_id,
# 'qty_available': product.qty_available,
'virtual_available': product.virtual_available,
# 'outgoing_qty': product.outgoing_qty,
# 'incoming_qty': product.incoming_qty,
'uom_id': product.uom_id.id,
# 按预测库存数补货or 1
'procurement_qty': procurement_qty,
'warehouse_id': warehouse_id,
'date_planned': datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT),
}])
try:
res.update({
'line_ids': line_ids,
})
except:
pass
return res
@api.multi
def validate(self):
self.ensure_one()
wiz = self[0]
assert wiz.line_ids, 'wizard must have some lines'
procs = self.env['procurement.order']
for line in wiz.line_ids:
if not line.procurement_qty:
continue
procurement = self.env['procurement.order'].create(
line._prepare_procurement_order())
procs += procurement
if not procs.ids:
raise Warning(_('All requested quantities are null.'))
# todo: 看是否需要记录工作流
# self.pool['procurement.order'].signal_workflow(
# self._cr, self._uid, new_po_ids, 'button_confirm')
# todo: 看是用 self.pool还是直接run当前用直接run
# self.pool['procurement.order'].run(
# self._cr, self._uid, new_po_ids, context=self.env.context)
procs.run()
action = self.env.ref('procurement.procurement_action').read()[0]
action['domain'] = [('id', 'in', procs.ids)]
return action
class ProcurementBatchGeneratorLine(models.TransientModel):
_name = 'procurement.batch.generator.line'
_description = 'Lines of the wizard to request procurements'
parent_id = fields.Many2one(
'procurement.batch.generator', string='Parent')
product_id = fields.Many2one(
'product.product', string='Product', readonly=True)
partner_id = fields.Many2one(
'res.partner', string='Supplier', required=False)
qty_available = fields.Float(
string='Quantity On Hand',
digits=dp.get_precision('Product Unit of Measure'), readonly=True)
virtual_available = fields.Float(
string='Forecast Quantity',
digits=dp.get_precision('Product Unit of Measure'), readonly=True)
outgoing_qty = fields.Float(
string='Incoming Quantity',
digits=dp.get_precision('Product Unit of Measure'), readonly=True)
incoming_qty = fields.Float(
string='Outgoing Quantity',
digits=dp.get_precision('Product Unit of Measure'), readonly=True)
procurement_qty = fields.Float(
string='Requested Quantity',
digits=dp.get_precision('Product Unit of Measure'), default=1)
uom_id = fields.Many2one(
'product.uom', string='Unit of Measure', readonly=True)
warehouse_id = fields.Many2one(
'stock.warehouse', string='Warehouse')
date_planned = fields.Datetime(string='Planned Date')
@api.multi
def _prepare_procurement_order(self):
self.ensure_one()
vals = {
'name': 'INT: %s' % (self.env.user.login),
'date_planned': self.date_planned,
'product_id': self.product_id.id,
'product_qty': self.procurement_qty,
'product_uom': self.uom_id.id,
'location_id': self.warehouse_id.lot_stock_id.id,
'company_id': self.warehouse_id.company_id.id,
'route_ids': [(6, 0, self.parent_id.route_ids.ids)],
}
return vals

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="procurement_batch_generator_wiz_form" model="ir.ui.view">
<field name="name">procurement.batch.generator.form</field>
<field name="model">procurement.batch.generator</field>
<field name="arch" type="xml">
<form string="Request Procurements">
<group>
<field name="route_ids" widget="many2many_tags" groups="stock.group_adv_location" invisible="1"/>
</group>
<group name="main">
<field name="line_ids" context="{'default_parent_id': active_id}" nolabel="1" colspan="2">
<tree editable="bottom" create="0" delete="0">
<field name="parent_id" invisible="1"/>
<field name="product_id"/>
<!--<field name="qty_available"/>-->
<field name="virtual_available"/>
<field name="uom_id" groups="product.group_uom"/>
<!--<field name="partner_id" readonly="1"/>-->
<field name="procurement_qty"/>
<field name="warehouse_id" options="{'no_open':True,'no_create':True}"/>
<field name="date_planned" widget="date"/>
</tree>
</field>
</group>
<footer>
<button type="object" name="validate"
string="Validate" class="oe_highlight"/>
<button special="cancel" string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
<act_window id="procurement_batch_generator_tree_action"
multi="True"
key2="client_action_multi"
name="Request Procurements"
res_model="procurement.batch.generator"
src_model="product.template"
view_mode="form"
target="new"/>
<act_window id="procurement_batch_generator_tree_action2"
multi="True"
key2="client_action_multi"
name="Request Procurements"
res_model="procurement.batch.generator"
src_model="product.product"
view_mode="form"
target="new"/>
</data>
</openerp>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="product_set_supplier_wiz_form" model="ir.ui.view">
<field name="name">product.set.supplier.wiz.form</field>
<field name="model">product.set.supplier.wiz</field>
<field name="arch" type="xml">
<form string="Set Supplier">
<group>
<group><field name="name" options="{'no_create': True, 'no_open':True}"/></group>
<group><field name="create_uid" readonly="1"/></group>
</group>
<group>
<group>
<field name="min_qty"/>
<field name="price"/>
</group>
<group>
<label for="date_start" string="Validity From"/>
<newline/>
<field name="date_start" nolabel="1" class="oe_inline"/><field name="date_end" nolabel="1" class="oe_inline"/>
<!--<field name="delay"/>-->
</group>
</group>
<!--<separator string="要设置供应商的补货单(仅对采购类型,且异常的补货单生效)"/>-->
<separator string="Procurement list to setup supplier for the product"/>
<group>
<field name="p_ids" nolabel="1" widget="many2many_tags"/>
</group>
<footer>
<button name="set_supplier" type="object" string="Set supplier and run Scheduler" class="btn-primary"/>
<!--<button name="set_supplier" type="object" string="设定供应商并执行自动采购策略" class="btn-primary"/>-->
<button string="Cancel" class="btn-default" special="cancel"/>
<field name="view_po" nolabel="1" class="oe_inline" style="margin-left:50px"/>
<label for="view_po"/>
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="product_set_supplier_action">
<field name="name">Set Supplier</field>
<field name="res_model">product.set.supplier.wiz</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="product_set_supplier_wiz_form"/>
<field name="target">new</field>
</record>
<act_window id="action_product_set_supplier"
multi="True"
key2="client_action_multi" name="Set Supplier"
res_model="product.set.supplier.wiz" src_model="procurement.order"
view_mode="form" target="new" view_type="form"
/>
</data>
</odoo>

View File

@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from datetime import datetime, timedelta
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
import odoo.addons.decimal_precision as dp
from odoo.exceptions import UserError
import time
class ProductSetSupplierWiz(models.TransientModel):
_name = 'product.set.supplier.wiz'
_description = 'Set supplier for product'
name = fields.Many2one(
'res.partner', 'Vendor',
domain=[('supplier', '=', True)], ondelete='cascade', required=True,
help="Vendor of this product")
min_qty = fields.Float(
'Minimal Quantity', default=0.0, required=True,
help="The minimal quantity to purchase from this vendor, expressed in the vendor Product Unit of Measure if not any, in the default unit of measure of the product otherwise.")
price = fields.Float(
'Price', default=0.0, digits=dp.get_precision('Product Price'),
required=True, help="The price to purchase a product")
company_id = fields.Many2one(
'res.company', 'Company',
default=lambda self: self.env.user.company_id.id, index=1)
currency_id = fields.Many2one(
'res.currency', 'Currency',
default=lambda self: self.env.user.company_id.currency_id.id,
required=True)
date_start = fields.Date('Start Date', help="Start date for this vendor price")
date_end = fields.Date('End Date', help="End date for this vendor price")
delay = fields.Integer(
'Delivery Lead Time', default=1, required=True,
help="Lead time in days between the confirmation of the purchase order and the receipt of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning.")
# 通过过滤得到要设置的补货单
p_ids = fields.Many2many('procurement.order', string='Procurement to set', readonly=True)
# 设置完后是否直接显示po
view_po = fields.Boolean('Show relate RFQ after set supplier', default=True)
# 默认值
@api.model
def default_get(self, fields):
res = super(ProductSetSupplierWiz, self).default_get(fields)
res['create_uid'] = self.env.user.id
if not res.get('min_qty'):
res['min_qty'] = 1
if not res.get('date_start'):
res['date_start'] = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
if not res.get('date_end'):
res['date_end'] = (datetime.now() + timedelta(days=1)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
procs_ids = self.env.context.get('active_ids')
procs = self.env['procurement.order'].browse(procs_ids).filtered(lambda x: x.rule_id.action == 'buy' and x.state == 'exception')
p_ids = procs.ids
res['p_ids'] = p_ids
if len(p_ids) < 1:
raise UserError(_("Please select valid procurement orders. Only the 'status=Exception' and 'Buy in Inventory Routes' product can be set!"))
# 请选择有效的补货单。只有需要采购的异常补货单才可进行设置!
return res
# 为选定的产品设定供应商,只处理系统没处理的
@api.multi
def set_supplier(self):
self.ensure_one()
procs_ids = self.env.context.get('active_ids')
procs = self.env['procurement.order'].browse(procs_ids).filtered(lambda x: x.rule_id.action == 'buy' and x.state == 'exception')
t_ids = procs.mapped('product_id.product_tmpl_id').ids
# 去重复
t_ids = list(set(t_ids))
for t in t_ids:
self.env['product.supplierinfo'].create({
'name': self.name.id,
'product_tmpl_id': t,
'min_qty': self.min_qty,
'date_start': self.date_start,
'date_end': self.date_end,
'delay': self.delay,
})
time.sleep(1)
procs.run()
if self.view_po:
time.sleep(2)
p_names = procs.mapped('purchase_id.name')
p_names = list(set(p_names))
domain = [["name", "in", p_names]]
context = {
'search_default_name': p_names[0],
}
action = self.env.ref('purchase.purchase_rfq').read()[0]
if len(p_names) == 1:
action.update({
'context': context,
})
elif len(p_names) > 1:
action.update({
'domain': domain,
})
return action