Skip to content

Commit

Permalink
[ADD] analytic_partner
Browse files Browse the repository at this point in the history
Classify analytic items by partner
==================================

This module adds a partner on each analytic item for allowing to have another
dimension for analysing data.

It also handles the proper propagation of this field to the created analytic
entries when validating invoices.

Configuration
=============

You have to be granted as at least "Accountant" in your user profile and
have checked the "Analytic Accounting" access right.

Usage
=====

Go to Accounting > Analytic Journal Items, and there, you can set the partner
for the analytic items, and search or group by it.

You can also go to a partner, and click on the smart-button "Cost/Revenue",
placed on the upper-right part, and you will navigate to the analytic items
associated to this partner.

Known issues / Roadmap
======================

* This module hasn't been tested with *account_analytic_plans* module
installed, so maybe it's incompatible with it.
  • Loading branch information
pedrobaeza authored and docker-odoo committed Jan 16, 2025
1 parent 290825a commit 41a9c0e
Show file tree
Hide file tree
Showing 15 changed files with 542 additions and 0 deletions.
58 changes: 58 additions & 0 deletions analytic_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Classify analytic items by partner
==================================

This module adds a partner on each analytic item for allowing to have another
dimension for analysing data.

It also handles the proper propagation of this field to the created analytic
entries when validating invoices.

Configuration
=============

You have to be granted as at least "Accountant" in your user profile and
have checked the "Analytic Accounting" access right.

Usage
=====

Go to Accounting > Analytic Journal Items, and there, you can set the partner
for the analytic items, and search or group by it.

You can also go to a partner, and click on the smart-button "Cost/Revenue",
placed on the upper-right part, and you will navigate to the analytic items
associated to this partner.


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/87/8.0

Known issues / Roadmap
======================

* This module hasn't been tested with *account_analytic_plans* module
installed, so maybe it's incompatible with it.

Credits
=======

Contributors
------------

* Pedro M. Baeza <[email protected]>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit http://odoo-community.org.
4 changes: 4 additions & 0 deletions analytic_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
23 changes: 23 additions & 0 deletions analytic_partner/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name': 'Partner in analytics',
'version': '8.0.1.0.0',
'summary': 'Classify analytic entries by partner',
'category': 'Analytic Accounting',
'author': 'Serv. Tecnol. Avanzados - Pedro M. Baeza, '
'Antiun Ingeniería S.L., '
'Odoo Community Association (OCA)',
'website': 'http://www.serviciosbaeza.com',
'depends': [
'analytic',
'account',
],
'data': [
'views/account_analytic_line_views.xml',
'views/res_partner_views.xml',
],
"installable": True,
}
33 changes: 33 additions & 0 deletions analytic_partner/i18n/analytic_partner.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * analytic_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-08-12 23:41+0000\n"
"PO-Revision-Date: 2015-08-12 23:41+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: analytic_partner
#: view:res.partner:analytic_partner.view_partner_form_analytic
msgid "Cost/Revenue"
msgstr ""

#. module: analytic_partner
#: model:ir.actions.act_window,name:analytic_partner.act_analytic_cost_revenue
msgid "Costs & Revenues"
msgstr ""

#. module: analytic_partner
#: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner
#: field:account.analytic.line,partner_id:0
msgid "Partner"
msgstr ""

33 changes: 33 additions & 0 deletions analytic_partner/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * analytic_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-08-12 23:41+0000\n"
"PO-Revision-Date: 2015-08-12 23:41+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: analytic_partner
#: view:res.partner:analytic_partner.view_partner_form_analytic
msgid "Cost/Revenue"
msgstr "Costes/Ingresos"

#. module: analytic_partner
#: model:ir.actions.act_window,name:analytic_partner.act_analytic_cost_revenue
msgid "Costs & Revenues"
msgstr "Costes e ingresos"

#. module: analytic_partner
#: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner
#: field:account.analytic.line,partner_id:0
msgid "Partner"
msgstr "Empresa"

6 changes: 6 additions & 0 deletions analytic_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import account_analytic_line
from . import account_invoice
from . import account_move_line
12 changes: 12 additions & 0 deletions analytic_partner/models/account_analytic_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields


class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'

partner_id = fields.Many2one(
comodel_name='res.partner', string="Partner",
domain="[('parent_id', '=', False)]")
18 changes: 18 additions & 0 deletions analytic_partner/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

@api.multi
def _get_analytic_lines(self):
"""Put partner on generated analytic lines"""
iml = super(AccountInvoice, self)._get_analytic_lines()
for il in iml:
for analytic_vals in il.get('analytic_lines', []):
analytic_vals[2]['partner_id'] = (
self.partner_id.commercial_partner_id.id)
return iml
15 changes: 15 additions & 0 deletions analytic_partner/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api


class AccountMoveLine(models.Model):
_inherit = 'account.move.line'

@api.model
def _prepare_analytic_line(self, obj_line):
res = super(AccountMoveLine, self)._prepare_analytic_line(obj_line)
res['partner_id'] = (
obj_line.invoice.partner_id.commercial_partner_id.id)
return res
Binary file added analytic_partner/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 41a9c0e

Please sign in to comment.