Accept Merge Request #1894: (feature/mrp_bug_fixed -> develop)

Merge Request: 成品,坯料复制模板中的采购申请字段模板

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1894?initial=true
This commit is contained in:
胡尧
2025-03-06 16:03:14 +08:00
committed by Coding
4 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -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',
}

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import product_template

View File

@@ -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