add app_purchase_order_product_supplier_code

This commit is contained in:
ivan deng
2018-03-12 01:49:59 +08:00
parent b9ff0c210b
commit 114f50b50c
9 changed files with 236 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Created on 2018-03-12
# 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:
from . import models

View File

@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# Created on 2018-03-12
# 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:
{
"name": "App Purchase Order with Product Supplier Code",
"summary": "This module adds the supplier code defined in the product, to the purchase order line.",
"version": "10.0.1",
"author": "Sunpop.cn",
"website": "http://www.sunpop.cn",
"category": "Purchase Management",
"depends": ["purchase"],
"license": "AGPL-3",
"data": [
"views/purchase_order_view.xml",
],
'images': ['static/description/set1.jpg'],
'installable': True,
"price": 68.00,
"currency": "EUR",
'description': """
==============================
App Purchase Order Product Supplier Code
==============================
This module adds the supplier code defined in the product, to the purchase order line.
Usage
=====
To use this module:
#. Go to 'Purchase' and open a Purchase Order.
#. If the vendor has defined some code for any purchase order line they will be
displayed in the line under the column 'Product Supplier Code'.
""",
}

View File

@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * app_purchase_order_product_supplier_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20171107\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-11 17:45+0000\n"
"PO-Revision-Date: 2018-03-11 17:45+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_order_product_supplier_code
#: model:ir.model.fields,field_description:app_purchase_order_product_supplier_code.field_purchase_order_line_product_supplier_code
msgid "Product Supplier Code"
msgstr "Product Supplier Code"
#. module: app_purchase_order_product_supplier_code
#: model:ir.model,name:app_purchase_order_product_supplier_code.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "采购订单行"

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Created on 2018-03-12
# 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:
from . import purchase_order_line

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Created on 2018-03-12
# 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:
from openerp import api, fields, models, _
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.multi
def _compute_product_supplier_code(self):
product_supplierinfo_obj = self.env['product.supplierinfo']
for line in self:
partner = line.order_id.partner_id
product = line.product_id
if product and partner:
supplier_info = product_supplierinfo_obj.search([
'|', ('product_tmpl_id', '=', product.product_tmpl_id.id),
('product_id', '=', product.id),
('name', '=', partner.id)], limit=1)
if supplier_info:
code = supplier_info.product_code or ''
line.product_supplier_code = code
return True
product_supplier_code = fields.Char(string='Product Supplier Code',
compute=_compute_product_supplier_code)

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -0,0 +1,57 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_padded">
<h2 class="oe_slogan" style="color:#875A7B;">App Purchase Order Product Supplier Code</h2>
<div>
<p>
This module adds the supplier code defined in the product, to the purchase order line.
</p>
<h2>How to use</h2>
<ul>
<li>
Go to 'Purchase' and open a Purchase Order.
</li>
<li>
If the vendor has defined some code for any purchase order line they will be displayed in the line under the column 'Product Supplier Code'.
</li>
</ul>
<div>
<img class="oe_picture oe_screenshot" src="set1.jpg">
</div>
</div>
</div>
</section>
<section class="oe_container oe_separator">
</section>
<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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="purchase_order_form" model="ir.ui.view">
<field name="name">purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']//tree//field[@name='product_id']" position="after">
<field name="product_supplier_code"/>
</xpath>
</field>
</record>
<record id="purchase_order_line_tree" model="ir.ui.view">
<field name="name">purchase.order.line.tree</field>
<field name="model">purchase.order.line</field>
<field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_supplier_code"/>
</field>
</field>
</record>
</data>
</odoo>