添加功能
This commit is contained in:
@@ -11,3 +11,4 @@ class AttendanceIotUser(models.Model):
|
||||
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
|
||||
company_id = fields.Many2one(related='employee_id.company_id', string="公司", store=True)
|
||||
id_valid = fields.Date(string="有效日期")
|
||||
image_1920 = fields.Image("一寸照")
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="employee_id"/>
|
||||
<field name="image_1920"/>
|
||||
<field name="attendance_iot_id" column_invisible="1"/>
|
||||
<field name="attendance_address"/>
|
||||
<field name="department_id" column_invisible="1"/>
|
||||
|
||||
@@ -15,6 +15,15 @@ class AppletAddress(models.Model):
|
||||
latitude = fields.Float(string="纬度", digits=(16, 6))
|
||||
card_rice = fields.Integer(string="打卡范围(米)")
|
||||
|
||||
def update_employee(self):
|
||||
applet_ids = self.env["applet.address"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in applet_ids:
|
||||
matching_employees = self.env['hr.employee'].search([
|
||||
('company_id.name', '=', record.address_name)
|
||||
])
|
||||
record.employee_ids = [(6, 0, matching_employees.ids)]
|
||||
|
||||
|
||||
class AppletSecurity(models.Model):
|
||||
_name = 'applet.security'
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<tree editable="bottom">
|
||||
<field name="address_name"/>
|
||||
<field name="address_name2"/>
|
||||
<field name="employee_ids" widget="many2many_tags"/>
|
||||
<field name="employee_ids" widget="many2many_tags" column_invisible="1"/>
|
||||
<field name="longitude"/>
|
||||
<field name="latitude"/>
|
||||
<field name="card_rice"/>
|
||||
@@ -20,4 +20,11 @@
|
||||
<field name="res_model">applet.address</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
<record id="applet_address_write_resource_department" model="ir.actions.server">
|
||||
<field name="name">更新员工</field>
|
||||
<field name="model_id" ref="yuthon_hr_attendance.model_applet_address"/>
|
||||
<field name="binding_model_id" ref="yuthon_hr_attendance.model_applet_address"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_employee()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -174,11 +174,11 @@
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="18"
|
||||
action="yuthon_hr_attendance.applet_address_action"/>
|
||||
<menuitem id="menu_applet_security_board"
|
||||
name="小程序权限管理"
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="19"
|
||||
action="yuthon_hr_attendance.applet_security_action"/>
|
||||
<!-- <menuitem id="menu_applet_security_board"-->
|
||||
<!-- name="小程序权限管理"-->
|
||||
<!-- parent="hr_attendance_root_board_menu"-->
|
||||
<!-- sequence="19"-->
|
||||
<!-- action="yuthon_hr_attendance.applet_security_action"/>-->
|
||||
<menuitem id="menu_attendance_iot_board"
|
||||
name="考勤机设备管理"
|
||||
parent="hr_attendance_root_board_menu"
|
||||
|
||||
Reference in New Issue
Block a user