Browse Source
Merge pull request #1 from SerpentCS/8.0-account_entries_report_hooks
Merge pull request #1 from SerpentCS/8.0-account_entries_report_hooks
[ADD] : Added account_report_entries_hooks modulepull/153/head
Jordi Ballester Alomar
9 years ago
5 changed files with 183 additions and 0 deletions
-
74account_entries_report_hooks/README.rst
-
6account_entries_report_hooks/__init__.py
-
21account_entries_report_hooks/__openerp__.py
-
6account_entries_report_hooks/report/__init__.py
-
76account_entries_report_hooks/report/account_entries_report.py
@ -0,0 +1,74 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
=============================== |
||||
|
Account Entries Report Hooks |
||||
|
=============================== |
||||
|
|
||||
|
This model extends the functionality of the "Account Entries Report" |
||||
|
by overriding the standard query with a new one that will allow other |
||||
|
modules to extend more flexibly. |
||||
|
|
||||
|
Installation |
||||
|
============ |
||||
|
|
||||
|
No external library is used. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
|
||||
|
In order to extend the Account Entries Report, you need to: |
||||
|
- Include this module as dependency in your own module |
||||
|
- Inherit from "account.entries.report" module |
||||
|
- Add your own fields, as needed |
||||
|
- Implement one of the new methods _select, _from, _where, _group_by, calling |
||||
|
first to the super() method and then adding the extra string as needed. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
||||
|
:alt: Try me on Runbot |
||||
|
:target: https://runbot.odoo-community.org/runbot/91/8.0 |
||||
|
|
||||
|
Bug Tracker |
||||
|
=========== |
||||
|
|
||||
|
Bugs are tracked on `GitHub Issues |
||||
|
<https://github.com/OCA/91/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 |
||||
|
<https://github.com/OCA/ |
||||
|
91/issues/new?body=module:%20 |
||||
|
account_entries_report_hooks%0Aversion:%20 |
||||
|
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Images |
||||
|
------ |
||||
|
|
||||
|
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Eficent Business and IT Consulting Services S.L. <contact@eficent.com> |
||||
|
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com> |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
.. image:: https://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. |
@ -0,0 +1,6 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2015 Eficent Business and IT Consulting Services S.L. - |
||||
|
# Jordi Ballester Alomar |
||||
|
# © 2015 Serpent Consulting Services Pvt. Ltd. |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
|
from . import report |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2015 Eficent Business and IT Consulting Services S.L. - |
||||
|
# Jordi Ballester Alomar |
||||
|
# © 2015 Serpent Consulting Services Pvt. Ltd. |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
|
{ |
||||
|
'name' : 'Account Entries Report Hooks', |
||||
|
'version' : '8.0.1.0.0', |
||||
|
"author": "Eficent Business and IT Consulting Services S.L., " |
||||
|
"Serpent Consulting Services Pvt. Ltd.," |
||||
|
"Odoo Community Association (OCA)", |
||||
|
'category' : 'Accounting & Finance', |
||||
|
'description' : """ |
||||
|
This module |
||||
|
""", |
||||
|
"website": "http://www.eficent.com", |
||||
|
"license": "AGPL-3", |
||||
|
'depends' : ['account'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2015 Eficent Business and IT Consulting Services S.L. - |
||||
|
# Jordi Ballester Alomar |
||||
|
# © 2015 Serpent Consulting Services Pvt. Ltd. |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
|
from . import account_entries_report |
@ -0,0 +1,76 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2015 Eficent Business and IT Consulting Services S.L. - |
||||
|
# Jordi Ballester Alomar |
||||
|
# © 2015 Serpent Consulting Services Pvt. Ltd. |
||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
||||
|
from openerp import tools |
||||
|
from openerp import models |
||||
|
import openerp.addons.decimal_precision as dp |
||||
|
|
||||
|
|
||||
|
class account_entries_report(models.Model): |
||||
|
_inherit = "account.entries.report" |
||||
|
|
||||
|
def _select(self): |
||||
|
select_str = """ |
||||
|
SELECT |
||||
|
l.id as id, |
||||
|
am.date as date, |
||||
|
l.date_maturity as date_maturity, |
||||
|
l.date_created as date_created, |
||||
|
am.ref as ref, |
||||
|
am.state as move_state, |
||||
|
l.state as move_line_state, |
||||
|
l.reconcile_id as reconcile_id, |
||||
|
l.partner_id as partner_id, |
||||
|
l.product_id as product_id, |
||||
|
l.product_uom_id as product_uom_id, |
||||
|
am.company_id as company_id, |
||||
|
am.journal_id as journal_id, |
||||
|
p.fiscalyear_id as fiscalyear_id, |
||||
|
am.period_id as period_id, |
||||
|
l.account_id as account_id, |
||||
|
l.analytic_account_id as analytic_account_id, |
||||
|
a.type as type, |
||||
|
a.user_type as user_type, |
||||
|
1 as nbr, |
||||
|
l.quantity as quantity, |
||||
|
l.currency_id as currency_id, |
||||
|
l.amount_currency as amount_currency, |
||||
|
l.debit as debit, |
||||
|
l.credit as credit, |
||||
|
coalesce(l.debit, 0.0) - coalesce(l.credit, 0.0) as balance |
||||
|
""" |
||||
|
return select_str |
||||
|
|
||||
|
def _from(self): |
||||
|
from_str=""" |
||||
|
FROM |
||||
|
account_move_line l |
||||
|
left join account_account a on (l.account_id = a.id) |
||||
|
left join account_move am on (am.id=l.move_id) |
||||
|
left join account_period p on (am.period_id=p.id) |
||||
|
|
||||
|
""" |
||||
|
return from_str |
||||
|
|
||||
|
def _where(self): |
||||
|
where_str = """ |
||||
|
where l.state != 'draft' |
||||
|
""" |
||||
|
return where_str |
||||
|
|
||||
|
def _group_by(self): |
||||
|
group_by_str = """ |
||||
|
""" |
||||
|
return group_by_str |
||||
|
|
||||
|
def init(self, cr): |
||||
|
tools.drop_view_if_exists(cr, self._table) |
||||
|
cr.execute("""CREATE or REPLACE VIEW %s as ( |
||||
|
%s |
||||
|
%s |
||||
|
%s |
||||
|
%s |
||||
|
)""" % (self._table, self._select(), self._from(), self._where(), |
||||
|
self._group_by())) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue