Add new action
This commit is contained in:
parent
400e84ffe5
commit
aa7dc3326e
|
|
@ -23,6 +23,7 @@
|
||||||
},
|
},
|
||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
|
'data/data.xml',
|
||||||
'views/attendance_zone_config_view.xml',
|
'views/attendance_zone_config_view.xml',
|
||||||
'views/hr_employee_view.xml',
|
'views/hr_employee_view.xml',
|
||||||
'views/firebase_notifications.xml',
|
'views/firebase_notifications.xml',
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from odoo.http import request
|
||||||
from ...http_helper import http_helper
|
from ...http_helper import http_helper
|
||||||
from ...validator import validator
|
from ...validator import validator
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
|
from ast import literal_eval
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -651,7 +652,16 @@ class HrOfficialMissionRelatedModelsController(http.Controller):
|
||||||
# 2.2 Mission Destination
|
# 2.2 Mission Destination
|
||||||
@http.route(['/api/mission_destination'], type='http', auth='none', csrf=False, methods=['GET'])
|
@http.route(['/api/mission_destination'], type='http', auth='none', csrf=False, methods=['GET'])
|
||||||
def get_mission_destination_list(self, **kw):
|
def get_mission_destination_list(self, **kw):
|
||||||
destinations = request.env["mission.destination"].sudo().search([])
|
param = request.env['ir.config_parameter'].sudo().get_param('mission.destination.domain', '[]')
|
||||||
|
|
||||||
|
# evaluate the string into a domain list
|
||||||
|
try:
|
||||||
|
domain = literal_eval(param)
|
||||||
|
if not isinstance(domain, list):
|
||||||
|
domain = []
|
||||||
|
except Exception:
|
||||||
|
domain = []
|
||||||
|
destinations = request.env["mission.destination"].sudo().search(domain)
|
||||||
data = []
|
data = []
|
||||||
for dest in destinations:
|
for dest in destinations:
|
||||||
data.append({
|
data.append({
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="param_mission_destination_domain" model="ir.config_parameter">
|
||||||
|
<field name="key">mission.destination.domain</field>
|
||||||
|
<field name="value">[]</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in New Issue