Skip to content

Commit

Permalink
[ADD] migrate account_due_list to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiBForgeFlow committed Dec 19, 2016
1 parent b5664d9 commit acb148c
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 185 deletions.
22 changes: 12 additions & 10 deletions account_due_list/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Payments and due list
=====================

This module adds a due list of pending payments. The list contains every
expected payment, generated by invoices or by intermediate moves (for example,
generated by payment/direct debit orders with the module
*account_banking_payment_transfer*. The list is fully filterable.
The lists introduces menus to review receivables and payables open
items, in order to allow users quickly identify the due items and the
corresponding due dates.


Configuration
=============
Expand All @@ -21,11 +21,12 @@ Usage

To use this module, you need to go to:

* Accounting->Journal Entries->Payments and due list
* Invoicing / Sales / Receivables Open Items
* Invoicing / Purchases / Payables Open Items

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

Known issues / Roadmap
======================
Expand All @@ -43,19 +44,20 @@ Contributors
* Alex Comba <alex.comba@agilebg.com> (OpenERP v7 port)
* Bruno Bottacini <bruno.bottacini@dorella.com> (OpenERP v7 port)
* Andrea Cometa <info@andreacometa.it> (Odoo v8 port)
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Jordi Ballester Alomar <jordi.ballester@eficent.com> (Odoo v9 port)

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://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.
To contribute to this module, please visit https://odoo-community.org.
11 changes: 11 additions & 0 deletions account_due_list/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# -*- coding: utf-8 -*-
# © 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# © 2011 Domsense srl (<http://www.domsense.com>)
# © 2011-2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2015 Andrea Cometa <info@andreacometa.it>
# © 2015 Eneko Lacunza <elacunza@binovo.es>
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models

44 changes: 15 additions & 29 deletions account_due_list/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
# @author Jordi Esteve <jesteve@zikzakmedia.com>
# @author Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# Ported to OpenERP 7.0 by Alex Comba <alex.comba@agilebg.com> and
# Bruno Bottacini <bruno.bottacini@dorella.com>
# Ported to Odoo by Andrea Cometa <info@andreacometa.it>
#
# 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/>.
#
##############################################################################
# © 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# © 2011 Domsense srl (<http://www.domsense.com>)
# © 2011-2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2015 Andrea Cometa <info@andreacometa.it>
# © 2015 Eneko Lacunza <elacunza@binovo.es>
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': "Payments Due list",
'version': '8.0.0.2.0',
'name': "Receivables and Payables Open Items",
'version': '9.0.1.0.0',
'category': 'Generic Modules/Payment',
'author': 'Odoo Community Association (OCA), '
'Agile Business Group, '
'Serv. Tecnol. Avanzados - Pedro M. Baeza,'
'Zikzakmedia SL',
'Zikzakmedia SL,'
'Eficent Business and Consulting Services S.L.',
'website': 'http://www.agilebg.com',
'license': 'AGPL-3',
"depends": [
'account',
],
"data": [
'views/payment_view.xml',
'views/receivables_payables_view.xml',
],
'installable': False,
}
18 changes: 18 additions & 0 deletions account_due_list/migrations/8.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# © 2016 Savoir-faire Linux
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


column_drops = {
('account_move_line', 'day'),
}


@openupgrade.migrate()
def migrate(cr, version):
if not version:
return

openupgrade.drop_columns(cr, column_drops)
16 changes: 16 additions & 0 deletions account_due_list/migrations/9.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2015 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import logging

logger = logging.getLogger('upgrade')


def migrate(cr, version):
logger.info("Migrating account_due_list from version %s", version)
if not version:
return

cr.execute('ALTER TABLE account_move_line DROP COLUMN maturity_residual')
cr.execute('ALTER TABLE account_move_line DROP COLUMN stored_invoice_id')
10 changes: 10 additions & 0 deletions account_due_list/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# -*- coding: utf-8 -*-
# © 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# © 2011 Domsense srl (<http://www.domsense.com>)
# © 2011-2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2015 Andrea Cometa <info@andreacometa.it>
# © 2015 Eneko Lacunza <elacunza@binovo.es>
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import account_move_line
81 changes: 16 additions & 65 deletions account_due_list/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
# Ported to Odoo by Andrea Cometa <info@andreacometa.it>
# Ported to v8 API by Eneko Lacunza <elacunza@binovo.es>
# Copyright (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
#
# 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/>.
#
##############################################################################
# © 2008 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# © 2011 Domsense srl (<http://www.domsense.com>)
# © 2011-2013 Agile Business Group sagl (<http://www.agilebg.com>)
# © 2015 Andrea Cometa <info@andreacometa.it>
# © 2015 Eneko Lacunza <elacunza@binovo.es>
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api


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

invoice_origin = fields.Char(related='invoice.origin', string='Source Doc')
invoice_date = fields.Date(related='invoice.date_invoice',
invoice_origin = fields.Char(related='invoice_id.origin',
string='Source Doc')
invoice_date = fields.Date(related='invoice_id.date_invoice',
string='Invoice Date')
partner_ref = fields.Char(related='partner_id.ref', string='Partner Ref')
payment_term_id = fields.Many2one('account.payment.term',
related='invoice.payment_term',
related='invoice_id.payment_term_id',
string='Payment Terms')
stored_invoice_id = fields.Many2one(
comodel_name='account.invoice', compute='_compute_invoice',
string='Invoice', store=True)
maturity_residual = fields.Float(
compute='_maturity_residual', string="Residual Amount", store=True,
help="The residual amount on a receivable or payable of a journal "
"entry expressed in the company currency.")
day = fields.Char(compute='_get_day', string='Day', size=16, store=True)

@api.multi
@api.depends('date_maturity', 'debit', 'credit', 'reconcile_id',
'reconcile_partial_id', 'account_id.reconcile',
'amount_currency', 'reconcile_partial_id.line_partial_ids',
'currency_id', 'company_id.currency_id')
def _maturity_residual(self):
"""
inspired by amount_residual
"""
for move_line in self:
sign = (move_line.debit - move_line.credit) < 0 and -1 or 1
move_line.maturity_residual = move_line.amount_residual * sign

@api.multi
@api.depends('move_id', 'invoice.move_id')
def _compute_invoice(self):
for line in self:
invoices = self.env['account.invoice'].search(
[('move_id', '=', line.move_id.id)])
line.stored_invoice_id = invoices[:1]

@api.depends('date_maturity')
def _get_day(self):
for line in self:
if line.date_maturity:
line.day = line.date_maturity
else:
line.day = False
invoice_user_id = fields.Many2one(
comodel_name='res.users', related='invoice_id.user_id',
string="Invoice salesperson", store=True)

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
Expand Down
81 changes: 0 additions & 81 deletions account_due_list/views/payment_view.xml

This file was deleted.

0 comments on commit acb148c

Please sign in to comment.