-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eloi Rivard
committed
Feb 9, 2020
0 parents
commit 0f48143
Showing
2,835 changed files
with
386,780 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Basic module for custom security stuff | ||
====================================== | ||
|
||
The module add checkbox "Custom Group" and puts such access groups to the top of "Access Rights" tab of user form. It helps to manage user roles via creating custom group that is collection of a technical groups. | ||
|
||
How to create or edit custom groups: | ||
|
||
* open Settings->Users->Groups | ||
* choose some group or create new | ||
|
||
* set checkbox "Custom Group" | ||
* set Application | ||
|
||
To create "Application groups", i.e. it get Selection field in Access Rights tab, groups must belong to the same Application inherit each other. | ||
|
||
How to apply groups for some users: | ||
|
||
* open Settings->Users->Users | ||
* select user you need | ||
* click "clear access rights" | ||
* tick access groups you need. In the main, you have to use only ones from "Custom User Groups" sector, because all inherited tick boxes will be ticked automatically, after you click save. | ||
* click save | ||
|
||
Please note, that if you delete some technical group from custom group, then you have to repeat process of applying groups for each related users. If you don't repeat applying process then removed group would be kept in related users, because there is no way to figure out is it was added by inheritance or manually as a extra access to that user. | ||
|
||
*See access_custom module as example of usage.* | ||
|
||
Tested on 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import models |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': 'Basic module for custom security stuff', | ||
'version': '1.0.0', | ||
'author': 'IT-Projects LLC, Ivan Yelizariev', | ||
'license': 'LGPL-3', | ||
"category": "Access", | ||
'website': 'https://yelizariev.github.io', | ||
'images': ['images/user.png'], | ||
'depends': ['base', 'res_users_clear_access_rights'], | ||
'data': [ | ||
'views.xml', | ||
], | ||
'installable': True | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- coding: utf-8 -*- | ||
from openerp import fields, api, models | ||
from lxml import etree | ||
from lxml.builder import E | ||
from openerp.tools.translate import _ | ||
from openerp.addons.base.res.res_users import name_boolean_group, name_selection_groups | ||
|
||
|
||
class GroupsView(models.Model): | ||
_inherit = 'res.groups' | ||
is_custom_group = fields.Boolean("Custom Group", help="show group at the top of Access Rights tab in user form") | ||
|
||
@api.model | ||
def update_user_groups_view(self): | ||
# call super to make module compatible with other modules (e.g. access_restricted) | ||
super(GroupsView, self).update_user_groups_view() | ||
|
||
if self._context.get('install_mode'): | ||
# use installation/admin language for translatable names in the view | ||
user_context = self.env['res.users'].context_get() | ||
self = self.with_context(**user_context) | ||
|
||
# We have to try-catch this, because at first init the view does not | ||
# exist but we are already creating some basic groups. | ||
view = self.env.ref('base.user_groups_view', raise_if_not_found=False) | ||
if view and view.exists() and view._name == 'ir.ui.view': | ||
group_no_one = view.env.ref('base.group_no_one') | ||
xml1, xml2 = [], [] | ||
xml1.append(E.separator(string=_('Application'), colspan="2")) | ||
|
||
xml3 = [] | ||
xml3.append(E.separator(string=_('Custom User Groups'), colspan="4")) | ||
|
||
for app, kind, gs in self.get_groups_by_application(): | ||
xml = None | ||
custom = False | ||
if kind == 'selection' and any([g.is_custom_group for g in gs]) or all([g.is_custom_group for g in gs]): | ||
xml = xml3 | ||
custom = True | ||
|
||
# hide groups in category 'Hidden' (except to group_no_one) | ||
attrs = {'groups': 'base.group_no_one'} if app and (app.xml_id == 'base.module_category_hidden' or app.xml_id == 'base.module_category_extra') and not custom else {} | ||
|
||
if kind == 'selection': | ||
xml = xml or xml1 | ||
# application name with a selection field | ||
field_name = name_selection_groups(map(int, gs)) | ||
xml.append(E.field(name=field_name, **attrs)) | ||
xml.append(E.newline()) | ||
else: | ||
xml = xml or xml2 | ||
# application separator with boolean fields | ||
app_name = app and app.name or _('Other') | ||
if not custom: | ||
xml.append(E.separator(string=app_name, colspan="4", **attrs)) | ||
for g in gs: | ||
field_name = name_boolean_group(g.id) | ||
if g == group_no_one: | ||
# make the group_no_one invisible in the form view | ||
xml.append(E.field(name=field_name, invisible="1", **attrs)) | ||
else: | ||
xml.append(E.field(name=field_name, **attrs)) | ||
|
||
xml2.append({'class': "o_label_nowrap"}) | ||
xml = E.field(E.group(*(xml3), col="2"), E.group(*(xml2), col="4"), E.group(*(xml1), col="2"), name="groups_id", position="replace") | ||
xml.addprevious(etree.Comment("GENERATED AUTOMATICALLY BY GROUPS")) | ||
xml_content = etree.tostring(xml, pretty_print=True, xml_declaration=True, encoding="utf-8") | ||
view.write({'arch': xml_content}) | ||
return True |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0"?> | ||
<openerp> | ||
<data> | ||
|
||
<record id="view_groups_form" model="ir.ui.view" > | ||
<field name="name">view.groups.form</field> | ||
<field name="model">res.groups</field> | ||
<field name="inherit_id" ref="base.view_groups_form"/> | ||
<field name="arch" type="xml"> | ||
|
||
<xpath expr="//field[@name='name']" position="after"> | ||
<field name="is_custom_group"/> | ||
</xpath> | ||
|
||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) | ||
|
||
from . import report | ||
from . import wizard |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2018-Today: La Louve (<https://cooplalouve.fr>) | ||
# @author: Simon Mas (linkedin.com/in/simon-mas) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': 'Account Asset Management xlsx', | ||
'version': '9.0.1.0.0', | ||
'category': 'Accounting', | ||
'summary': 'account_asset_management_xlsx', | ||
'author': 'Simon Mas, Ân Lê Hoàng', | ||
'website': 'https://cooplalouve.fr', | ||
'depends': [ | ||
'account', | ||
'account_asset', | ||
'report_xlsx', | ||
], | ||
'data': [ | ||
"report/report_account_asset_xlsx.xml", | ||
"security/ir.model.access.csv", | ||
"wizard/account_asset_xlsx_wizard.xml", | ||
], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_asset_management_xlsx | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-12-10 04:19+0000\n" | ||
"PO-Revision-Date: 2018-12-10 04:19+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.actions.report.xml,name:account_asset_management_xlsx.report_account_asset_xlsx | ||
msgid "Account Asset Report" | ||
msgstr "Account Asset Report" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.ui.view,arch_db:account_asset_management_xlsx.view_account_asset_xlsx_wizard | ||
msgid "Account Asset Xlsx Wizard" | ||
msgstr "Account Asset Xlsx Wizard" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: selection:account.asset.xlsx.wizard,asset_state:0 | ||
msgid "All assets" | ||
msgstr "Toutes les immobilisations" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: selection:account.asset.xlsx.wizard,target_move:0 | ||
msgid "All moves" | ||
msgstr "Toutes les écritures" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_asset_category_ids | ||
msgid "Asset Categories" | ||
msgstr "Catégories" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.ui.menu,name:account_asset_management_xlsx.open_account_asset_xlsx_wizard | ||
msgid "Asset Report Xlsx" | ||
msgstr "État immobilisations" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.ui.view,arch_db:account_asset_management_xlsx.view_account_asset_xlsx_wizard | ||
msgid "Cancel" | ||
msgstr "Annuler" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_create_uid | ||
msgid "Created by" | ||
msgstr "Créé par" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_create_date | ||
msgid "Created on" | ||
msgstr "Créé le" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_display_name | ||
msgid "Display Name" | ||
msgstr "Nom affiché" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.ui.view,arch_db:account_asset_management_xlsx.view_account_asset_xlsx_wizard | ||
msgid "Export" | ||
msgstr "Exporter" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.actions.act_window,name:account_asset_management_xlsx.action_account_asset_xlsx_wizard | ||
msgid "Export Account Asset Report" | ||
msgstr "Export Account Asset Report" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_from_date | ||
msgid "From date" | ||
msgstr "Début" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard___last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière modification le" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_write_uid | ||
msgid "Last Updated by" | ||
msgstr "Mis à jour par" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_write_date | ||
msgid "Last Updated on" | ||
msgstr "Mis à jour le" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: selection:account.asset.xlsx.wizard,asset_state:0 | ||
msgid "Open only" | ||
msgstr "Uniquement les immobilisations en cours" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: selection:account.asset.xlsx.wizard,target_move:0 | ||
msgid "Posted moves" | ||
msgstr "Toutes les écritures comptabilisées" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_asset_state | ||
msgid "Status" | ||
msgstr "Statut" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_target_move | ||
msgid "Target move" | ||
msgstr "Target move" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model.fields,field_description:account_asset_management_xlsx.field_account_asset_xlsx_wizard_to_date | ||
msgid "To date" | ||
msgstr "Fin" | ||
|
||
#. module: account_asset_management_xlsx | ||
#: model:ir.model,name:account_asset_management_xlsx.model_account_asset_xlsx_wizard | ||
msgid "account.asset.xlsx.wizard" | ||
msgstr "account.asset.xlsx.wizard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) | ||
|
||
from . import report_account_asset_xlsx |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) | ||
|
||
from openerp.tools import image as IMG | ||
import base64 | ||
import os | ||
import logging | ||
import tempfile | ||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def get_record_image_path(record, image, size=(128, 128)): | ||
""" | ||
:param record: instance of model | ||
:param image: example: product_id.image | ||
:param size: example: (128, 128) | ||
:return: path to image or None if no image | ||
""" | ||
if not image: | ||
return None | ||
|
||
temp_folder = tempfile.mkdtemp() | ||
record_image_path = os.path.join( | ||
temp_folder, str(record.id) + ".jpg") | ||
try: | ||
record_image = IMG.image_resize_image( | ||
image, size) | ||
record_image = base64.b64decode(record_image) | ||
with open(record_image_path, 'wb') as f: | ||
f.write(record_image) | ||
return record_image_path | ||
except Exception as e: | ||
logging.error('Error when processing the image for' | ||
'record: %s: %s', record, str(e)) | ||
raise e | ||
return False |
Binary file not shown.
Oops, something went wrong.