fix attendance

This commit is contained in:
Bakry 2024-10-03 14:10:07 +03:00
parent a3e6a37c1b
commit b28afaa627
4 changed files with 14 additions and 2 deletions

View File

@ -196,6 +196,7 @@ class AttendanceController(http.Controller):
'zone':zone.zone if zone else "%s,%s" % (body.get('longitude'), body.get('latitude')),
'longitude': body.get('longitude'),
'latitude':body.get('latitude'),
'zone_name':zone.id if zone else False,
})
if attendance:
if body.get('action') == 'sign_out' and system_checkout == True:
@ -212,6 +213,7 @@ class AttendanceController(http.Controller):
"longitude": attendance.longitude,
"latitude": attendance.latitude,
"range": zone.allowed_range if zone else False,
"zone_name":attendance.zone_name if zone_name else False,
}
msg = (_("Check Out successfully")) if body.get('action') == 'sign_out' else (_("Check in successfully"))
else:

View File

@ -2183,6 +2183,11 @@ msgstr ""
msgid "Zone"
msgstr "منطقة"
#. module: odex_mobile
#: model:ir.model.fields,field_description:odex_mobile.field_attendance_attendance__zone_name
msgid "Zone Name"
msgstr "إسم المنطقة"
#. module: odex_mobile
#: model:ir.actions.server,name:odex_mobile.hr_zone_archive_ir_actions_server
#: model:ir.cron,cron_name:odex_mobile.hr_zone_archive

View File

@ -145,6 +145,8 @@ class Attendance(models.Model):
latitude = fields.Char(string="Latitude")
longitude = fields.Char(string="Longitude")
zone_name = fields.Many2one("attendance.zone", readonly=True, store=True)
def open_url(self):
if self.latitude and self.longitude:

View File

@ -26,7 +26,10 @@
<field name="priority">100</field>
<field name="arch" type="xml">
<field name="action_type" position="after">
<field name="zone"/>
<field name="zone_name" readonly="1"/>
<field name="zone" readonly="1"/>
<!--button name="open_url" string="Open Location" class="oe_highlight" type="object"
attrs="{'invisible':[('zone','=',False)]}"/-->
</field>
</field>
</record>
@ -186,4 +189,4 @@
action="attendance_log_custom_action"/>
</data>
</odoo>
</odoo>