bom物料清单
This commit is contained in:
34
sf_tool_management/models/tool_inventory.py
Normal file
34
sf_tool_management/models/tool_inventory.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from odoo import models, fields
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class ToolInventory(models.Model):
|
||||
_inherit = 'sf.tool.inventory'
|
||||
_description = '功能刀具清单'
|
||||
knife_handle_model = fields.Selection([('BT30', 'BT30'), ('BT40', 'BT40'), ('BT50', 'BT50'), ('GSK30', 'GSK30'), ('GSK40', 'GSK40'), ('GSK50', 'GSK50')], string='使用刀柄型号')
|
||||
jikimo_bom_ids = fields.One2many('jikimo.bom','tool_inventory_id', 'bom单')
|
||||
def bom_mainfest(self):
|
||||
|
||||
jikimo_bom_ids = self.mapped('jikimo_bom_ids')
|
||||
if not jikimo_bom_ids:
|
||||
self._bom_mainfest()
|
||||
return self.bom_mainfest()
|
||||
request.session['jikimo_bom_product'] = {'bom_id': int(self.jikimo_bom_ids)}
|
||||
# context = dict(self.env.context)
|
||||
# context.update({'jikimo_bom_product': self.jikimo_bom_ids.options})
|
||||
# if self.functional_cutting_tool_model_id.cutting_tool_type_ids:
|
||||
# context.update({'jikimo_bom_product_cutting_tool_type': self.functional_cutting_tool_model_id.cutting_tool_type_ids.ids})
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': '刀具组装清单',
|
||||
'res_model': 'jikimo.bom',
|
||||
'view_mode': 'form',
|
||||
'view_id': self.env.ref('sf_tool_management.view_jikimo_bom_form').id,
|
||||
'res_id': int(self.jikimo_bom_ids),
|
||||
'target': 'current', # Use 'new' to open in a new window/tab
|
||||
# {'jikimo_bom_product': self.jikimo_bom_ids.options}
|
||||
}
|
||||
|
||||
# 创建bom单
|
||||
def _bom_mainfest(self):
|
||||
self.env['jikimo.bom'].create({'tool_inventory_id':self.id})
|
||||
Reference in New Issue
Block a user