diff --git a/app_purchase_order_product_supplier_code/__init__.py b/app_purchase_order_product_supplier_code/__init__.py new file mode 100644 index 00000000..75aa7726 --- /dev/null +++ b/app_purchase_order_product_supplier_code/__init__.py @@ -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 diff --git a/app_purchase_order_product_supplier_code/__openerp__.py b/app_purchase_order_product_supplier_code/__openerp__.py new file mode 100644 index 00000000..3d7f6fb1 --- /dev/null +++ b/app_purchase_order_product_supplier_code/__openerp__.py @@ -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'. + """, +} diff --git a/app_purchase_order_product_supplier_code/i18n/zh_CN.po b/app_purchase_order_product_supplier_code/i18n/zh_CN.po new file mode 100644 index 00000000..1da82e19 --- /dev/null +++ b/app_purchase_order_product_supplier_code/i18n/zh_CN.po @@ -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 "采购订单行" + diff --git a/app_purchase_order_product_supplier_code/models/__init__.py b/app_purchase_order_product_supplier_code/models/__init__.py new file mode 100644 index 00000000..f08ffdd4 --- /dev/null +++ b/app_purchase_order_product_supplier_code/models/__init__.py @@ -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 diff --git a/app_purchase_order_product_supplier_code/models/purchase_order_line.py b/app_purchase_order_product_supplier_code/models/purchase_order_line.py new file mode 100644 index 00000000..0f2c705d --- /dev/null +++ b/app_purchase_order_product_supplier_code/models/purchase_order_line.py @@ -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) diff --git a/app_purchase_order_product_supplier_code/static/description/icon.png b/app_purchase_order_product_supplier_code/static/description/icon.png new file mode 100644 index 00000000..2a04f219 Binary files /dev/null and b/app_purchase_order_product_supplier_code/static/description/icon.png differ diff --git a/app_purchase_order_product_supplier_code/static/description/index.html b/app_purchase_order_product_supplier_code/static/description/index.html new file mode 100644 index 00000000..7333f8dd --- /dev/null +++ b/app_purchase_order_product_supplier_code/static/description/index.html @@ -0,0 +1,57 @@ +
+
+

App Purchase Order Product Supplier Code

+
+

+ This module adds the supplier code defined in the product, to the purchase order line. +

+

How to use

+
    +
  • + 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'. +
  • +
+
+ +
+
+
+
+ +
+
+ +
+
+
+

Technical Help & Support

+
+
+
+

+ For any type of technical help & support requests, Feel free to contact us

+ + guohuadeng@hotmail.com +

+ Via QQ: 300883

+ + 300883@qq.com +
+
+

+ Visit our website for more support.

+ + http://www.sunpop.cn +
+
+
+
\ No newline at end of file diff --git a/app_purchase_order_product_supplier_code/static/description/set1.jpg b/app_purchase_order_product_supplier_code/static/description/set1.jpg new file mode 100644 index 00000000..d0ba3603 Binary files /dev/null and b/app_purchase_order_product_supplier_code/static/description/set1.jpg differ diff --git a/app_purchase_order_product_supplier_code/views/purchase_order_view.xml b/app_purchase_order_product_supplier_code/views/purchase_order_view.xml new file mode 100644 index 00000000..35d3fbe3 --- /dev/null +++ b/app_purchase_order_product_supplier_code/views/purchase_order_view.xml @@ -0,0 +1,26 @@ + + + + + purchase.order.form + purchase.order + + + + + + + + + + purchase.order.line.tree + purchase.order.line + + + + + + + + +