mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #1 from yvaucher/7.0-add-account_balance_line
[ADD] account_balance_line: Add a balance total for grouped lines in move line view. Balance field will only be shown when move lines are grouped by account or filtered by account.
This commit is contained in:
21
account_balance_line/__init__.py
Normal file
21
account_balance_line/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Vincent Renaville (Camptocamp)
|
||||
# Copyright 2010-2014 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import account_move_line
|
||||
52
account_balance_line/__openerp__.py
Normal file
52
account_balance_line/__openerp__.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Vincent Renaville (Camptocamp)
|
||||
# Copyright 2010-2014 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
{'name' : 'Balance on lines',
|
||||
'summary': 'Display balance totals in move line view',
|
||||
'version' : '1.1',
|
||||
'author' : 'Camptocamp',
|
||||
'maintainter' : 'Camptocamp',
|
||||
'category': 'Accounting',
|
||||
'depends' : ['account'],
|
||||
'description': """
|
||||
Balance for a line
|
||||
==================
|
||||
|
||||
Add a balance total for grouped lines in move line view.
|
||||
|
||||
Balance field will only be shown when move lines are grouped by account
|
||||
or filtered by account.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Vincent revaville <vincent.renaville@camptocamp.com>
|
||||
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'data': [
|
||||
'account_move_line_view.xml',
|
||||
],
|
||||
'tests': [],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
}
|
||||
42
account_balance_line/account_move_line.py
Normal file
42
account_balance_line/account_move_line.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Vincent Renaville (Camptocamp)
|
||||
# Copyright 2010-2014 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class account_move_line(orm.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
def _line_balance(self, cr, uid, ids, field, arg, context=None):
|
||||
res = {}
|
||||
move_lines = self.read(cr, uid, ids,
|
||||
['debit', 'credit'],
|
||||
context=context)
|
||||
|
||||
for line in move_lines:
|
||||
res[line['id']] = line['debit'] - line['credit']
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'line_balance': fields.function(
|
||||
_line_balance, method=True,
|
||||
string='Balance',
|
||||
store=True),
|
||||
}
|
||||
30
account_balance_line/account_move_line_view.xml
Normal file
30
account_balance_line/account_move_line_view.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_move_line_filter_balance" model="ir.ui.view">
|
||||
<field name="name">Journal Items add visibilty for balance</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_account_move_line_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="account_id" position="attributes">
|
||||
<attribute name="context">{'invisible_balance': False}</attribute>
|
||||
</field>
|
||||
<filter string="Account" position="attributes">
|
||||
<attribute name="context">{'group_by': 'account_id', 'invisible_balance': False}</attribute>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_move_line_balance_custom">
|
||||
<field name="name">account_move_line_balance_custom</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="credit" position="after" >
|
||||
<field name="line_balance" sum="Total Balance" invisible="context.get('invisible_balance', True)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
53
account_balance_line/i18n/account_balance_line.pot
Normal file
53
account_balance_line/i18n/account_balance_line.pot
Normal file
@@ -0,0 +1,53 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_balance_line
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-06-20 14:11+0000\n"
|
||||
"PO-Revision-Date: 2014-06-20 14:11+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_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "Account"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: model:ir.model,name:account_balance_line.model_account_move_line
|
||||
msgid "Entry lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: code:_description:0
|
||||
#, python-format
|
||||
msgid "Journal Items"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: field:account.move.line,line_balance:0
|
||||
msgid "Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "Total Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "{'group_by': 'account_id', 'invisible_balance': False}"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "{'invisible_balance': False}"
|
||||
msgstr ""
|
||||
|
||||
53
account_balance_line/i18n/fr.po
Normal file
53
account_balance_line/i18n/fr.po
Normal file
@@ -0,0 +1,53 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_balance_line
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-06-20 14:11+0000\n"
|
||||
"PO-Revision-Date: 2014-06-20 14:11+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_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#. module: account_balance_line
|
||||
#: model:ir.model,name:account_balance_line.model_account_move_line
|
||||
msgid "Entry lines"
|
||||
msgstr "Lignes d'écriture"
|
||||
|
||||
#. module: account_balance_line
|
||||
#: code:_description:0
|
||||
#, python-format
|
||||
msgid "Journal Items"
|
||||
msgstr "Écritures comptables"
|
||||
|
||||
#. module: account_balance_line
|
||||
#: field:account.move.line,line_balance:0
|
||||
msgid "Balance"
|
||||
msgstr "Balance"
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "Total Balance"
|
||||
msgstr "Balance Totale"
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "{'group_by': 'account_id', 'invisible_balance': False}"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_balance_line
|
||||
#: view:account.move.line:0
|
||||
msgid "{'invisible_balance': False}"
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user