diff --git a/account_group/README.rst b/account_group/README.rst new file mode 100644 index 000000000..0937ee2e9 --- /dev/null +++ b/account_group/README.rst @@ -0,0 +1,115 @@ +=================== +Groups for accounts +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github + :target: https://github.com/OCA/account-financial-tools/tree/10.0/account_group + :alt: OCA/account-financial-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-financial-tools-10-0/account-financial-tools-10-0-account_group + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/92/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This modules brings to version 10 the account group feature from v11. + +It also includes a level field for indicating the level depth of the account +group. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +If you have already the chart of accounts loaded on your company, you will +need to update it through the module `account_chart_update`. Follow the +instructions on that module for that. + +Configuration +============= + +To configure account groups, you need to: + +#. Be "Account / Adviser" role. +#. Go to *Invoicing/Accounting > Configuration > Accounting > Accounts Groups*. +#. Create or modify existing groups. + +For assigning groups to account templates, you have to: + +#. Set the group on your account chart module or extension. +#. Or develop/create UI access. + +When you have groups on your account templates, you can load a chart template +for a new company, and they will be transferred to created accounts. + +Usage +===== + +For assigning groups to accounts: + +#. Go to *Invoicing > Adviser > Chart of Accounts*. +#. Edit one account and set "Group" field. + +Known issues / Roadmap +====================== + +* This module shouldn't be migrated to v11, as it's a native feature. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `__: + + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/account-financial-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_group/__init__.py b/account_group/__init__.py new file mode 100644 index 000000000..69f6d6ffd --- /dev/null +++ b/account_group/__init__.py @@ -0,0 +1,4 @@ +# coding: utf-8 +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/account_group/__manifest__.py b/account_group/__manifest__.py new file mode 100644 index 000000000..4ebac6d93 --- /dev/null +++ b/account_group/__manifest__.py @@ -0,0 +1,22 @@ +# coding: utf-8 +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Groups for accounts", + "summary": "Use v11 account groups feature", + "version": "10.0.1.0.0", + "category": "Accounting", + "website": "https://github.com/OCA/account-financial-tools", + "author": "Tecnativa," + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": [ + "account", + ], + "data": [ + "security/ir.model.access.csv", + "views/account_account_views.xml", + "views/account_group_views.xml", + ], +} diff --git a/account_group/i18n/es.po b/account_group/i18n/es.po new file mode 100644 index 000000000..b69852d5c --- /dev/null +++ b/account_group/i18n/es.po @@ -0,0 +1,131 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-09-17 17:46+0000\n" +"PO-Revision-Date: 2018-09-17 17:46+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_group +#: model:ir.model,name:account_group.model_account_account +msgid "Account" +msgstr "Cuenta" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_account_ids +msgid "Accounts" +msgstr "Cuentas" + +#. module: account_group +#: model:ir.ui.view,arch_db:account_group.view_account_group_form +#: model:ir.ui.view,arch_db:account_group.view_account_group_search +#: model:ir.ui.view,arch_db:account_group.view_account_group_tree +msgid "Accounts Group" +msgstr "Grupo de cuentas" + +#. module: account_group +#: model:ir.actions.act_window,name:account_group.action_account_group_tree +#: model:ir.ui.menu,name:account_group.account_group_menu +#: model:ir.ui.view,arch_db:account_group.view_account_group_search +msgid "Accounts Groups" +msgstr "Grupos de cuentas" + +#. module: account_group +#: model:ir.model.fields,help:account_group.field_account_group_account_ids +msgid "Assigned accounts." +msgstr "Cuentas asignadas" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_code_prefix +msgid "Code prefix" +msgstr "Código prefijo" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_create_date +msgid "Created on" +msgstr "Creado el" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_display_name +msgid "Display Name" +msgstr "Nombre a mostrar" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_account_group_id +#: model:ir.model.fields,field_description:account_group.field_account_account_template_group_id +msgid "Group" +msgstr "Grupo" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_id +msgid "ID" +msgstr "ID" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group___last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_parent_left +msgid "Left Parent" +msgstr "Padre izquierdo" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_level +msgid "Level" +msgstr "Nivel" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_name +msgid "Name" +msgstr "Nombre" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_parent_id +msgid "Parent" +msgstr "Padre" + +#. module: account_group +#: model:ir.model.fields,field_description:account_group.field_account_group_parent_right +msgid "Right Parent" +msgstr "Padre derecho" + +#. module: account_group +#: model:ir.model,name:account_group.model_account_chart_template +msgid "Templates for Account Chart" +msgstr "Plantillas de plan contable" + +#. module: account_group +#: model:ir.model,name:account_group.model_account_account_template +msgid "Templates for Accounts" +msgstr "Plantillas de cuentas" + +#. module: account_group +#: model:ir.model,name:account_group.model_account_group +msgid "account.group" +msgstr "account.group" diff --git a/account_group/models/__init__.py b/account_group/models/__init__.py new file mode 100644 index 000000000..171e49961 --- /dev/null +++ b/account_group/models/__init__.py @@ -0,0 +1,7 @@ +# coding: utf-8 +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import account_account +from . import account_account_template +from . import account_chart_template +from . import account_group diff --git a/account_group/models/account_account.py b/account_group/models/account_account.py new file mode 100644 index 000000000..627f91517 --- /dev/null +++ b/account_group/models/account_account.py @@ -0,0 +1,30 @@ +# coding: utf-8 +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountAccount(models.Model): + _inherit = "account.account" + + group_id = fields.Many2one( + comodel_name='account.group', + string="Group", + ) + + @api.onchange('code') + def onchange_code(self): + AccountGroup = self.env['account.group'] + group = False + code_prefix = self.code + # find group with longest matching prefix + while code_prefix: + matching_group = AccountGroup.search([ + ('code_prefix', '=', code_prefix), + ], limit=1) + if matching_group: + group = matching_group + break + code_prefix = code_prefix[:-1] + self.group_id = group diff --git a/account_group/models/account_account_template.py b/account_group/models/account_account_template.py new file mode 100644 index 000000000..de4d3c70e --- /dev/null +++ b/account_group/models/account_account_template.py @@ -0,0 +1,14 @@ +# coding: utf-8 +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountAccountTemplate(models.Model): + _inherit = "account.account.template" + + group_id = fields.Many2one( + comodel_name='account.group', + string="Group", + ) diff --git a/account_group/models/account_chart_template.py b/account_group/models/account_chart_template.py new file mode 100644 index 000000000..90ebc94e5 --- /dev/null +++ b/account_group/models/account_chart_template.py @@ -0,0 +1,18 @@ +# coding: utf-8 +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class AccountChartTemplate(models.Model): + _inherit = "account.chart.template" + + def _get_account_vals(self, company, account_template, code_acc, + tax_template_ref): + """Add account group to created accounts.""" + res = super(AccountChartTemplate, self)._get_account_vals( + company, account_template, code_acc, tax_template_ref, + ) + res['group_id'] = account_template.group_id.id + return res diff --git a/account_group/models/account_group.py b/account_group/models/account_group.py new file mode 100644 index 000000000..0190d334e --- /dev/null +++ b/account_group/models/account_group.py @@ -0,0 +1,74 @@ +# coding: utf-8 +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.osv import expression + + +class AccountGroup(models.Model): + _name = 'account.group' + _parent_store = True + _parent_order = 'name' + _order = 'code_prefix' + + parent_id = fields.Many2one( + comodel_name='account.group', + string="Parent", + index=True, + ondelete='cascade', + ) + parent_left = fields.Integer( + string='Left Parent', + index=True, + ) + parent_right = fields.Integer( + string='Right Parent', + index=True, + ) + name = fields.Char( + required=True, + ) + code_prefix = fields.Char() + account_ids = fields.One2many( + comodel_name='account.account', + inverse_name='group_id', + string='Accounts', + help="Assigned accounts.", + ) + level = fields.Integer( + compute='_compute_level', + store=True, + ) + + @api.depends('parent_id') + def _compute_level(self): + for group in self: + level = 1 + parent = group.parent_id + while parent: + level += 1 + parent = parent.parent_id + group.level = level + + def name_get(self): + result = [] + for group in self: + name = group.name + if group.code_prefix: + name = group.code_prefix + ' ' + name + result.append((group.id, name)) + return result + + @api.model + def name_search(self, name='', args=None, operator='ilike', limit=100): + if not args: + args = [] + criteria_operator = ( + ['|'] if operator not in expression.NEGATIVE_TERM_OPERATORS + else ['&', '!'] + ) + domain = criteria_operator + [ + ('code_prefix', '=ilike', name + '%'), ('name', operator, name) + ] + return self.search(domain + args, limit=limit).name_get() diff --git a/account_group/readme/CONFIGURE.rst b/account_group/readme/CONFIGURE.rst new file mode 100644 index 000000000..2d3762fec --- /dev/null +++ b/account_group/readme/CONFIGURE.rst @@ -0,0 +1,13 @@ +To configure account groups, you need to: + +#. Be "Account / Adviser" role. +#. Go to *Invoicing/Accounting > Configuration > Accounting > Accounts Groups*. +#. Create or modify existing groups. + +For assigning groups to account templates, you have to: + +#. Set the group on your account chart module or extension. +#. Or develop/create UI access. + +When you have groups on your account templates, you can load a chart template +for a new company, and they will be transferred to created accounts. diff --git a/account_group/readme/CONTRIBUTORS.rst b/account_group/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..2b13251be --- /dev/null +++ b/account_group/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Tecnativa `__: + + * Pedro M. Baeza diff --git a/account_group/readme/DESCRIPTION.rst b/account_group/readme/DESCRIPTION.rst new file mode 100644 index 000000000..94927a308 --- /dev/null +++ b/account_group/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This modules brings to version 10 the account group feature from v11. + +It also includes a level field for indicating the level depth of the account +group. diff --git a/account_group/readme/INSTALL.rst b/account_group/readme/INSTALL.rst new file mode 100644 index 000000000..9d6703b01 --- /dev/null +++ b/account_group/readme/INSTALL.rst @@ -0,0 +1,3 @@ +If you have already the chart of accounts loaded on your company, you will +need to update it through the module `account_chart_update`. Follow the +instructions on that module for that. diff --git a/account_group/readme/ROADMAP.rst b/account_group/readme/ROADMAP.rst new file mode 100644 index 000000000..8adc36330 --- /dev/null +++ b/account_group/readme/ROADMAP.rst @@ -0,0 +1 @@ +* This module shouldn't be migrated to v11, as it's a native feature. diff --git a/account_group/readme/USAGE.rst b/account_group/readme/USAGE.rst new file mode 100644 index 000000000..e54fe105d --- /dev/null +++ b/account_group/readme/USAGE.rst @@ -0,0 +1,4 @@ +For assigning groups to accounts: + +#. Go to *Invoicing > Adviser > Chart of Accounts*. +#. Edit one account and set "Group" field. diff --git a/account_group/security/ir.model.access.csv b/account_group/security/ir.model.access.csv new file mode 100644 index 000000000..833503320 --- /dev/null +++ b/account_group/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_group_manager,account.group,model_account_group,account.group_account_manager,1,1,1,1 +access_account_group,account.group,model_account_group,account.group_account_user,1,0,0,0 diff --git a/account_group/static/description/index.html b/account_group/static/description/index.html new file mode 100644 index 000000000..635505c11 --- /dev/null +++ b/account_group/static/description/index.html @@ -0,0 +1,464 @@ + + + + + + +Groups for accounts + + + +
+

Groups for accounts

+ + +

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

+

This modules brings to version 10 the account group feature from v11.

+

It also includes a level field for indicating the level depth of the account +group.

+

Table of contents

+ +
+

Installation

+

If you have already the chart of accounts loaded on your company, you will +need to update it through the module account_chart_update. Follow the +instructions on that module for that.

+
+
+

Configuration

+

To configure account groups, you need to:

+
    +
  1. Be “Account / Adviser” role.
  2. +
  3. Go to Invoicing/Accounting > Configuration > Accounting > Accounts Groups.
  4. +
  5. Create or modify existing groups.
  6. +
+

For assigning groups to account templates, you have to:

+
    +
  1. Set the group on your account chart module or extension.
  2. +
  3. Or develop/create UI access.
  4. +
+

When you have groups on your account templates, you can load a chart template +for a new company, and they will be transferred to created accounts.

+
+
+

Usage

+

For assigning groups to accounts:

+
    +
  1. Go to Invoicing > Adviser > Chart of Accounts.
  2. +
  3. Edit one account and set “Group” field.
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • This module shouldn’t be migrated to v11, as it’s a native feature.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/account-financial-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_group/views/account_account_views.xml b/account_group/views/account_account_views.xml new file mode 100644 index 000000000..e551bd7ca --- /dev/null +++ b/account_group/views/account_account_views.xml @@ -0,0 +1,13 @@ + + + + account.account + + + + + + + + + diff --git a/account_group/views/account_group_views.xml b/account_group/views/account_group_views.xml new file mode 100644 index 000000000..c4742dad5 --- /dev/null +++ b/account_group/views/account_group_views.xml @@ -0,0 +1,66 @@ + + + + account.group.form + account.group + +
+ + + + + + + + + + +
+
+
+ + + account.group.search + account.group + + + + + + + + + account.group.tree + account.group + + + + + + + + + + + Accounts Groups + account.group + form + tree,form + + + + + +