Merge pull request #1457 from expsa/dev_odex25_mobile

Dev odex25 mobile
This commit is contained in:
eslam 2024-10-07 10:36:03 +03:00 committed by GitHub
commit c682ecbbf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 1 deletions

View File

@ -488,7 +488,7 @@ class AttendanceController(http.Controller):
'title':subject,
'body':msg,
}
emp.user_push_notification(data)
# emp.user_push_notification(data)
def create_log(self, employee, longitude, latitude):
with request.env.cr.savepoint():

View File

@ -248,6 +248,10 @@ class RestApi(Controller):
res = obj.read(["id", "state"])[0]
state = res["state"]
btn_new = request.env[BTN].sudo().search([("workflow_id", "=", int(btn.workflow_id.id)), (("node_id.node_name", "=", state)), ], [],)
if btn_new.send_manager:
emp_manager = self.get_emp_manager(obj)
obj.firebase_notification(emp_manager.user_id)
return http_helper.response(message="Successful", data=res)
group_ids = btn_new.mapped("group_ids")
rule_groups = btn_new.mapped("group_ids").mapped("rule_groups").filtered(lambda rec:rec.model_id.model == obj._name)
users_list = self.access_users(group_ids, obj)
@ -270,6 +274,12 @@ class RestApi(Controller):
except:
return False
def get_emp_manager(self, record):
try:
return record.employee_id.parent_id
except:
return False
def access_users(self, groups, record):
users = []
for group in groups:

View File

@ -103,6 +103,12 @@ msgstr ""
msgid "Button String"
msgstr ""
#. module: odoo_dynamic_workflow_mobile
#: model:ir.model.fields,field_description:odoo_dynamic_workflow_mobile.field_workflow_mobile_node_button__send_manager
#: model:ir.model.fields,help:odoo_dynamic_workflow_mobile.field_workflow_mobile_node_button__send_manager
msgid "Send Direct Manager"
msgstr "ارسال المدير المباشر"
#. module: odoo_dynamic_workflow_mobile
#: code:addons/odoo_dynamic_workflow_mobile/models/odoo_workflow_mobile.py:0
#: model:ir.model.fields,field_description:odoo_dynamic_workflow_mobile.field_workflow_mobile_node__button_ids

View File

@ -387,6 +387,7 @@ class OdooWorkflowBtnWizard(models.Model):
btn_key = fields.Char(string='Button Key', default=_generate_key,readonly=True)
btn_hide = fields.Boolean(string="Hide Button if Condition isn't fulfilled", help="If condition is false the button will be hidden.",readonly=True)
condition_code = fields.Text(string='Condition Code', default=CONDITION_CODE_TEMP, help="Enter condition to execute button action.",readonly=True)
send_manager = fields.Boolean(string="Send Direct Manager", help="Send Direct Manager")
action_type = fields.Selection([
('link', 'Trigger Link'),
('code', 'Python Code'),

View File

@ -234,6 +234,7 @@ sell it under their names. ###-->
domain="[('type','=','form'),('model','=',model)]" />
<field name="btn_key" />
<field name="node_id" />
<field name="send_manager" />
</group>
<group>
<field name="is_highlight" />