Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #204 from nhatnm0612/197200-correct-id-roles
Browse files Browse the repository at this point in the history
[UPD] add groups to actions server
  • Loading branch information
gonzalesedwin1123 authored Mar 31, 2023
2 parents b2a1e3c + 1f6d9ba commit e7441f4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spp_idqueue/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
"views/registrant.xml",
"views/res_config_settings.xml",
],
"assets": {},
"assets": {
"web.assets_backend": [
"spp_idqueue/static/src/js/form_controller.js",
],
},
"demo": [],
"images": [],
"application": True,
Expand Down
16 changes: 16 additions & 0 deletions spp_idqueue/static/src/js/form_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
odoo.define("spp_idqueue.FormController", function (require) {
var FormController = require("web.FormController");
var session = require("web.session");

FormController.include({
willStart() {
const sup = this._super(...arguments);
const acl = session.user_has_group("spp_idqueue.group_g2p_id_requestor").then((hasGroup) => {
if (this.modelName === "res.partner" && hasGroup) {
this.hasActionMenus = false;
}
});
return Promise.all([sup, acl]);
},
});
});
5 changes: 5 additions & 0 deletions spp_idqueue/views/id_batch_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.multi_approve_batch()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="multi_generate_batch">
Expand All @@ -387,6 +388,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.multi_generate_batch()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="multi_print_batch">
Expand All @@ -396,6 +398,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.multi_print_batch()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="multi_printed_batch">
Expand All @@ -405,6 +408,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.multi_printed_batch()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="multi_distribute_batch">
Expand All @@ -414,5 +418,6 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.multi_distribute_batch()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_distributor'))]" />
</record>
</odoo>
5 changes: 5 additions & 0 deletions spp_idqueue/views/id_queue_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = model.open_wizard()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="validate_requests">
Expand All @@ -310,6 +311,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.validate_requests()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="generate_requests">
Expand All @@ -319,6 +321,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.generate_validate_requests()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="print_requests">
Expand All @@ -328,6 +331,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.print_requests()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_validator'))]" />
</record>

<record model="ir.actions.server" id="distribute_requests">
Expand All @@ -337,6 +341,7 @@
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.distribute_requests()</field>
<field name="groups_id" eval="[(4, ref('spp_idqueue.group_g2p_id_distributor'))]" />
</record>

</odoo>

0 comments on commit e7441f4

Please sign in to comment.