[ADD] account_set_reconcilable
parent
17c3ec9964
commit
e3590c6919
|
@ -0,0 +1,54 @@
|
||||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||||
|
:target: https://www.gnu.org/licenses/agpl
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
|
||||||
|
========================
|
||||||
|
Account Set Reconcilable
|
||||||
|
========================
|
||||||
|
|
||||||
|
Allows to set as reconcilable a non reconcilable account that already have journal items.
|
||||||
|
|
||||||
|
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/98/11.0
|
||||||
|
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues
|
||||||
|
<https://github.com/OCA/account-reconcile/issues>`_. In case of trouble, please
|
||||||
|
check there if your issue has already been reported. If you spotted it first,
|
||||||
|
help us smash it by providing detailed and welcomed feedback.
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Images
|
||||||
|
------
|
||||||
|
|
||||||
|
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Miquel Raïch <miquel.raich@eficent.com>
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
: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 https://odoo-community.org.
|
|
@ -0,0 +1,3 @@
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from . import models
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "Account Set Reconcilable",
|
||||||
|
"summary": "Allows to set as reconcilable a non reconcilable"
|
||||||
|
"account that already have journal items.",
|
||||||
|
"version": "11.0.1.0.0",
|
||||||
|
"depends": ["account"],
|
||||||
|
"author": "Eficent, Odoo Community Association (OCA)",
|
||||||
|
"website": "http://www.github.com/OCA/account-reconcile",
|
||||||
|
"category": "Finance",
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'installable': True,
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from . import account_account
|
|
@ -0,0 +1,31 @@
|
||||||
|
# © 2018 Eficent Business and IT Consulting Services S.L. (www.eficent.com)
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAccount(models.Model):
|
||||||
|
_inherit = "account.account"
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def write(self, vals):
|
||||||
|
reconcile = False
|
||||||
|
if vals.get('reconcile', False) and not self.env.context.get(
|
||||||
|
'set_reconcilable', False):
|
||||||
|
reconcile = vals.pop('reconcile')
|
||||||
|
rec = super(AccountAccount, self).write(vals=vals)
|
||||||
|
if reconcile:
|
||||||
|
moves_lines = self.env['account.move.line'].search(
|
||||||
|
[('account_id', 'in', self.ids)])
|
||||||
|
for account in self:
|
||||||
|
lines = moves_lines.filtered(
|
||||||
|
lambda line: line.account_id == account)
|
||||||
|
if lines:
|
||||||
|
t_account = account.copy()
|
||||||
|
lines.write({'account_id': t_account.id})
|
||||||
|
account.with_context(set_reconcilable=True).write(
|
||||||
|
{'reconcile': reconcile})
|
||||||
|
lines.write({'account_id': account.id})
|
||||||
|
lines._amount_residual()
|
||||||
|
t_account.unlink()
|
||||||
|
return rec
|
|
@ -0,0 +1 @@
|
||||||
|
* Miquel Raïch <miquel.raich@eficent.com>
|
|
@ -0,0 +1 @@
|
||||||
|
Allows to set as reconcilable a non reconcilable account that already have journal items.
|
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
Loading…
Reference in New Issue