diff --git a/jikimo_purchase_request/__init__.py b/jikimo_purchase_request/__init__.py new file mode 100644 index 00000000..a0fdc10f --- /dev/null +++ b/jikimo_purchase_request/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/jikimo_purchase_request/__manifest__.py b/jikimo_purchase_request/__manifest__.py new file mode 100644 index 00000000..f2054556 --- /dev/null +++ b/jikimo_purchase_request/__manifest__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +{ + 'name': '机企猫 采购申请', + 'version': '16.0.1.0.0', + 'summary': """ 机企猫 采购申请 """, + 'author': '机企猫', + 'website': 'https://bfw.jikimo.com', + 'category': 'purchase', + 'depends': ['sf_manufacturing', 'purchase_request'], + 'data': [ + + ], + # 'assets': { + # 'web.assets_backend': [ + # 'jikimo_purchase_request/static/src/**/*' + # ], + # }, + 'application': True, + 'installable': True, + 'auto_install': False, + 'license': 'LGPL-3', +} diff --git a/jikimo_purchase_request/models/__init__.py b/jikimo_purchase_request/models/__init__.py new file mode 100644 index 00000000..1c32c33a --- /dev/null +++ b/jikimo_purchase_request/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import product_template \ No newline at end of file diff --git a/jikimo_purchase_request/models/product_template.py b/jikimo_purchase_request/models/product_template.py new file mode 100644 index 00000000..e6e96f10 --- /dev/null +++ b/jikimo_purchase_request/models/product_template.py @@ -0,0 +1,17 @@ +from odoo import models, fields + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + purchase_request_id = fields.Many2one('purchase.request', string='采购申请') + + def no_bom_product_create(self, product_id, item, order_id, route_type, i, finish_product): + """ 创建坯料时,复制采购申请 """ + template_id = super(ProductTemplate, self).no_bom_product_create(product_id, item, order_id, route_type, i, finish_product) + template_id.purchase_request = product_id.purchase_request + return template_id + + def copy_template(self, product_template_id): + """ 复制成品模板时,复制采购申请 """ + super(ProductTemplate, self).copy_template(product_template_id) + self.purchase_request = product_template_id.purchase_request \ No newline at end of file