Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
ea4bd98c21
  1. 4
      muk_utils/__manifest__.py
  2. 2
      muk_utils/models/__init__.py
  3. 10
      muk_utils/models/mixins_groups.py
  4. 8
      muk_utils/views/mixins_groups.xml

4
muk_utils/__manifest__.py

@ -20,7 +20,7 @@
{ {
"name": "MuK Utils", "name": "MuK Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": '12.0.1.1.2',
"version": '12.0.1.1.3',
"category": 'Extra Tools', "category": 'Extra Tools',
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",
@ -33,7 +33,7 @@
"base_setup", "base_setup",
], ],
"data": [ "data": [
"views/groups.xml",
"views/mixins_groups.xml",
"views/res_config_settings_view.xml", "views/res_config_settings_view.xml",
], ],
"qweb": [ "qweb": [

2
muk_utils/models/__init__.py

@ -17,7 +17,7 @@
# #
################################################################################### ###################################################################################
from . import groups
from . import mixins_groups
from . import ir_attachment from . import ir_attachment
from . import res_config_settings from . import res_config_settings

10
muk_utils/models/groups.py → muk_utils/models/mixins_groups.py

@ -21,7 +21,7 @@ from odoo import models, fields, api
class Groups(models.AbstractModel): class Groups(models.AbstractModel):
_name = 'muk_utils.groups'
_name = 'muk_utils.mixins.groups'
_parent_store = True _parent_store = True
_parent_name = "parent_group" _parent_name = "parent_group"
@ -50,9 +50,7 @@ class Groups(models.AbstractModel):
def add(name, field): def add(name, field):
if name not in self._fields: if name not in self._fields:
self._add_field(name, field) self._add_field(name, field)
base, model = self._name.split(".")
add('parent_group', fields.Many2one( add('parent_group', fields.Many2one(
_module=base,
comodel_name=self._name, comodel_name=self._name,
string='Parent Group', string='Parent Group',
ondelete='cascade', ondelete='cascade',
@ -60,13 +58,11 @@ class Groups(models.AbstractModel):
index=True, index=True,
automatic=True)) automatic=True))
add('child_groups', fields.One2many( add('child_groups', fields.One2many(
_module=base,
comodel_name=self._name, comodel_name=self._name,
inverse_name='parent_group', inverse_name='parent_group',
string='Child Groups', string='Child Groups',
automatic=True)) automatic=True))
add('groups', fields.Many2many( add('groups', fields.Many2many(
_module=base,
comodel_name='res.groups', comodel_name='res.groups',
relation='%s_groups_rel' % (self._table), relation='%s_groups_rel' % (self._table),
column1='gid', column1='gid',
@ -74,7 +70,6 @@ class Groups(models.AbstractModel):
string='Groups', string='Groups',
automatic=True)) automatic=True))
add('explicit_users', fields.Many2many( add('explicit_users', fields.Many2many(
_module=base,
comodel_name='res.users', comodel_name='res.users',
relation='%s_explicit_users_rel' % (self._table), relation='%s_explicit_users_rel' % (self._table),
column1='gid', column1='gid',
@ -82,7 +77,6 @@ class Groups(models.AbstractModel):
string='Explicit Users', string='Explicit Users',
automatic=True)) automatic=True))
add('users', fields.Many2many( add('users', fields.Many2many(
_module=base,
comodel_name='res.users', comodel_name='res.users',
relation='%s_users_rel' % (self._table), relation='%s_users_rel' % (self._table),
column1='gid', column1='gid',
@ -100,7 +94,7 @@ class Groups(models.AbstractModel):
# Read, View # Read, View
#---------------------------------------------------------- #----------------------------------------------------------
@api.depends('parent_group.users', 'groups', 'groups.users', 'explicit_users')
@api.depends('parent_group', 'parent_group.users', 'groups', 'groups.users', 'explicit_users')
def _compute_users(self): def _compute_users(self):
print(self) print(self)
for record in self: for record in self:

8
muk_utils/views/groups.xml → muk_utils/views/mixins_groups.xml

@ -20,8 +20,8 @@
<odoo> <odoo>
<record id="view_groups_tree" model="ir.ui.view"> <record id="view_groups_tree" model="ir.ui.view">
<field name="name">muk_utils_groups.tree</field>
<field name="model">muk_utils.groups</field>
<field name="name">muk_utils_mixins_groups.tree</field>
<field name="model">muk_utils.mixins.groups</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Groups"> <tree string="Groups">
<field name="name" /> <field name="name" />
@ -31,8 +31,8 @@
</record> </record>
<record id="view_groups_form" model="ir.ui.view"> <record id="view_groups_form" model="ir.ui.view">
<field name="name">muk_utils_groups.form</field>
<field name="model">muk_utils.groups</field>
<field name="name">muk_utils_mixins_groups.form</field>
<field name="model">muk_utils.mixins.groups</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Group"> <form string="Group">
<sheet> <sheet>
Loading…
Cancel
Save