Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jan 12: [IMP] Group by module name 'hide_menu_user' #301

Open
wants to merge 5 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hide_menu_user/models/res_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ class RestrictMenu(models.Model):
_inherit = 'ir.ui.menu'

restrict_user_ids = fields.Many2many('res.users')
module_name = fields.Char('Module Name', compute='_compute_module_name', store=True)

@api.depends('complete_name')
def _compute_module_name(self):
for menu in self:
module_name = menu.complete_name.split('/')[0] if menu.complete_name else ''
menu.module_name = module_name
34 changes: 32 additions & 2 deletions hide_menu_user/views/res_users.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Hide Specific Menu" attrs="{'invisible': [('is_admin','=', True)]}">
<page string="Hide Specific Menu" attrs="{'invisible': [('is_admin','=', True)]}">
<tree>
<field name="hide_menu_ids"/>
<field name="hide_menu_ids" context="{'search_default_module':1, 'search_view_ref': 'hide_menu_user.edit_menu_access_search_custom', 'tree_view_ref': 'hide_menu_user.edit_menu_custom'}"/>
</tree>
</page>
</xpath>
Expand All @@ -32,5 +32,35 @@
</xpath>
</field>
</record>

<record id="edit_menu_access_search_custom" model="ir.ui.view">
<field name="name">ir.ui.menu.search</field>
<field name="model">ir.ui.menu</field>
<field name="arch" type="xml">
<search string="Menu">
<field name="name" string="Menu"/>
<field name="parent_id"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<group expand="0" string="Group By">
<filter string="Module" name="module" domain="[]" context="{'group_by':'module_name'}"/>
</group>
</search>
</field>
</record>

<record id="edit_menu_custom" model="ir.ui.view">
<field name="model">ir.ui.menu</field>
<field name="inherit_id" ref="base.edit_menu"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="replace">
<tree string="Menu">
<field name="module_name" invisible="1"/>
<field name="sequence" widget='handle'/>
<field icon="icon" name="complete_name" string="Menu"/>
</tree>
</xpath>
</field>
</record>
</data>
</odoo>
5 changes: 5 additions & 0 deletions pos_mrp_order/models/point_of_sale_make_mrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def create_mrp_from_pos(self, products):
'move_finished_ids': [
(0, 0, finished_vals)]
})
# This piece of code gets the order done immediately
immediate_production = self.env['mrp.immediate.production'].sudo().create(
{'mo_ids': [(6, 0, mrp_order.ids)], 'immediate_production_line_ids': [
(0, 0, {'production_id': mrp_order.id, 'to_immediate': True})]}).process()
mrp_order.button_mark_done()
return True


Expand Down