我创建了一个自定义模块,用于在创建员工时自动创建用户。它工作正常但用户和员工之间的链接尚未创建(相关用户尚未创建)
related user not linking with user
<record id="view_users_form_inherit" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<field name="employee_id" readonly="1" required="0" groups="base.group_no_one"
attrs="{'invisible': [('parent_id', '=', False)]}"/>
</xpath>
</field>
</record>
@api.model
def create(self, vals):
result = super(ResUsersInherit, self).create(vals)
print vals
result['employee_id'] = self.env['res.users'].create({'name': vals['name'],'login': vals['work_email']})
return result
答案 0 :(得分:2)
您需要覆盖(扩展)<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.7.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.0</version>
</dependency>
的创建方法,并且您需要在下面编写代码。
hr.employee
问题:
你分配了对象而不是id,所以我只用id替换了对象。