[ADD] module account_balance_line

This commit is contained in:
Yannick Vaucher
2014-06-27 14:56:25 +02:00
parent af8d0355fb
commit d61d5d72ba
6 changed files with 251 additions and 0 deletions

View 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 # noqa

View 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,
}

View 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 osv, fields
class account_move_line(osv.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),
}

View 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>

View 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 ""

View 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 ""