在 Many2one 字段中创建值 来自 many2many 向导(或)TransientModel
Create values in Many2one field From many2many wizard (or) TransientModel
从以下代码我在 Many2one 字段中创建值从向导的 many2many 标记字段(或)TransientModel
def add_employee_btn(self):
record = self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
vals={'employee_names':e.name,
'issue_id': record.id}
res = self.env['issues.issues'].create(vals)
我需要另一种方法,像这样使用 List 追加..
def add_employee_btn(self):
list = []
record=self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
list.append(({0,0,{'employee_names':e.name,
'issue_id': record.id}}))
但是出现错误如果有人知道修复它...
def add_employee_btn(self):
list = []
record=self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
list.append([0,0,{'employee_names':e.name,
'issue_id': record.id}])
请试试这个,它可能会帮助您解决错误。
从以下代码我在 Many2one 字段中创建值从向导的 many2many 标记字段(或)TransientModel
def add_employee_btn(self):
record = self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
vals={'employee_names':e.name,
'issue_id': record.id}
res = self.env['issues.issues'].create(vals)
我需要另一种方法,像这样使用 List 追加..
def add_employee_btn(self):
list = []
record=self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
list.append(({0,0,{'employee_names':e.name,
'issue_id': record.id}}))
但是出现错误如果有人知道修复它...
def add_employee_btn(self):
list = []
record=self.env['add.employees'].browse(self._context.get('active_id'))
for e in self.employee_ids:
list.append([0,0,{'employee_names':e.name,
'issue_id': record.id}])
请试试这个,它可能会帮助您解决错误。