Browse Source

[CHNG] User Check Issue Fixed

pull/81/head
SHEREEF PT 8 years ago
parent
commit
828c20a634
  1. 10
      user_creation_from_employee/user_creation_from_employee.py
  2. 4
      user_creation_from_employee/user_creation_from_employee_view.xml

10
user_creation_from_employee/user_creation_from_employee.py

@ -26,7 +26,7 @@ from openerp import models, fields, api, _
class ResUsersInherit(models.Model): class ResUsersInherit(models.Model):
_inherit = 'hr.employee' _inherit = 'hr.employee'
user_check = fields.Boolean(default=False) user_check_test = fields.Boolean(default=False)
@api.multi @api.multi
def create_user(self): def create_user(self):
@ -34,12 +34,12 @@ class ResUsersInherit(models.Model):
'login': self.work_email, 'login': self.work_email,
}) })
self.address_home_id = user_id.partner_id.id self.address_home_id = user_id.partner_id.id
self.user_check = True self.user_check_test = True
@api.onchange('address_home_id') @api.onchange('address_home_id')
def user_check(self): def user_check_test(self):
if self.address_home_id: if self.address_home_id:
self.user_check = True self.user_check_test = True
else: else:
self.user_check = False self.user_check_test = False

4
user_creation_from_employee/user_creation_from_employee_view.xml

@ -7,12 +7,12 @@
<field name="inherit_id" ref="hr.view_employee_form"/> <field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="work_email" position="after"> <field name="work_email" position="after">
<field name="user_check" invisible="1"/> <field name="user_check_test" invisible="1"/>
</field> </field>
<xpath expr="//form/sheet" position="before"> <xpath expr="//form/sheet" position="before">
<header> <header>
<button name="create_user" string="Create User" type="object" class="oe_highlight" <button name="create_user" string="Create User" type="object" class="oe_highlight"
attrs="{'invisible':[('user_check','=',True)]}"/> attrs="{'invisible':[('user_check_test','=',True)]}"/>
</header> </header>
</xpath> </xpath>
<field name="work_email" position="attributes"> <field name="work_email" position="attributes">

Loading…
Cancel
Save