mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MIG] account_mass_reconcile: Migration to 13.0
This commit is contained in:
committed by
Miquel Raïch
parent
efca7067ef
commit
e2e9562692
@@ -14,13 +14,13 @@ Account Mass Reconcile
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/account-reconcile/tree/12.0/account_mass_reconcile
|
||||
:target: https://github.com/OCA/account-reconcile/tree/13.0/account_mass_reconcile
|
||||
:alt: OCA/account-reconcile
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/account-reconcile-12-0/account-reconcile-12-0-account_mass_reconcile
|
||||
:target: https://translation.odoo-community.org/projects/account-reconcile-13-0/account-reconcile-13-0-account_mass_reconcile
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/98/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/98/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -62,7 +62,7 @@ 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 smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_mass_reconcile%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_mass_reconcile%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@@ -96,6 +96,7 @@ Contributors
|
||||
* Damien Crier <damien.crier@camptocamp.com>
|
||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
* Mykhailo Panarin <m.panarin@mobilunity.com>
|
||||
* Adrià Gil Sorribes <adria.gil@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -110,6 +111,6 @@ 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.
|
||||
|
||||
This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/12.0/account_mass_reconcile>`_ project on GitHub.
|
||||
This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/13.0/account_mass_reconcile>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Mass Reconcile",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"depends": ["account"],
|
||||
"author": "Akretion,Camptocamp,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-reconcile",
|
||||
|
||||
@@ -9,6 +9,7 @@ class MassReconcileAdvancedRef(models.TransientModel):
|
||||
|
||||
_name = "mass.reconcile.advanced.ref"
|
||||
_inherit = "mass.reconcile.advanced"
|
||||
_description = "Mass Reconcile Advanced Ref"
|
||||
|
||||
@staticmethod
|
||||
def _skip_line(move_line):
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import logging
|
||||
from itertools import product
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
from odoo.tools.translate import _
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -14,6 +14,7 @@ _logger = logging.getLogger(__name__)
|
||||
class MassReconcileAdvanced(models.AbstractModel):
|
||||
_name = "mass.reconcile.advanced"
|
||||
_inherit = "mass.reconcile.base"
|
||||
_description = "Mass Reconcile Advanced"
|
||||
|
||||
def _query_debit(self):
|
||||
"""Select all move (debit>0) as candidate. """
|
||||
@@ -217,9 +218,9 @@ class MassReconcileAdvanced(models.AbstractModel):
|
||||
"""
|
||||
return False
|
||||
|
||||
@api.multi
|
||||
def _rec_auto_lines_advanced(self, credit_lines, debit_lines):
|
||||
""" Advanced reconciliation main loop """
|
||||
# pylint: disable=invalid-commit
|
||||
reconciled_ids = []
|
||||
for rec in self:
|
||||
reconcile_groups = []
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
from functools import reduce
|
||||
from operator import itemgetter
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import _, fields, models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class MassReconcileBase(models.AbstractModel):
|
||||
|
||||
_name = "mass.reconcile.base"
|
||||
_inherit = "mass.reconcile.options"
|
||||
_description = "Mass Reconcile Base"
|
||||
|
||||
account_id = fields.Many2one("account.account", string="Account", required=True)
|
||||
partner_ids = fields.Many2many(
|
||||
@@ -21,7 +22,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
)
|
||||
# other fields are inherited from mass.reconcile.options
|
||||
|
||||
@api.multi
|
||||
def automatic_reconcile(self):
|
||||
""" Reconciliation method called from the view.
|
||||
|
||||
@@ -65,7 +65,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
def _from_query(self, *args, **kwargs):
|
||||
return "FROM account_move_line "
|
||||
|
||||
@api.multi
|
||||
def _where_query(self, *args, **kwargs):
|
||||
self.ensure_one()
|
||||
where = (
|
||||
@@ -82,7 +81,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
params.append(tuple([l.id for l in self.partner_ids]))
|
||||
return where, params
|
||||
|
||||
@api.multi
|
||||
def _get_filter(self):
|
||||
self.ensure_one()
|
||||
ml_obj = self.env["account.move.line"]
|
||||
@@ -94,7 +92,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
where = " AND %s" % where
|
||||
return where, params
|
||||
|
||||
@api.multi
|
||||
def _below_writeoff_limit(self, lines, writeoff_limit):
|
||||
self.ensure_one()
|
||||
precision = self.env["decimal.precision"].precision_get("Account")
|
||||
@@ -109,7 +106,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
writeoff_amount = round(debit - credit, precision)
|
||||
return bool(writeoff_limit >= abs(writeoff_amount)), debit, credit
|
||||
|
||||
@api.multi
|
||||
def _get_rec_date(self, lines, based_on="end_period_last_credit"):
|
||||
self.ensure_one()
|
||||
|
||||
@@ -132,7 +128,6 @@ class MassReconcileBase(models.AbstractModel):
|
||||
# when date is None
|
||||
return None
|
||||
|
||||
@api.multi
|
||||
def _reconcile_lines(self, lines, allow_partial=False):
|
||||
""" Try to reconcile given lines
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from psycopg2.extensions import AsIs
|
||||
|
||||
from odoo import _, api, fields, models, sql_db
|
||||
from odoo.exceptions import Warning as UserError
|
||||
|
||||
@@ -37,7 +39,7 @@ class MassReconcileOptions(models.AbstractModel):
|
||||
string="Date of reconciliation",
|
||||
default="newest",
|
||||
)
|
||||
_filter = fields.Char(string="Filter", oldname="filter")
|
||||
_filter = fields.Char(string="Filter")
|
||||
income_exchange_account_id = fields.Many2one(
|
||||
"account.account", string="Gain Exchange Rate Account"
|
||||
)
|
||||
@@ -48,7 +50,7 @@ class MassReconcileOptions(models.AbstractModel):
|
||||
|
||||
class AccountMassReconcileMethod(models.Model):
|
||||
_name = "account.mass.reconcile.method"
|
||||
_description = "reconcile method for account_mass_reconcile"
|
||||
_description = "Reconcile Method for account_mass_reconcile"
|
||||
_inherit = "mass.reconcile.options"
|
||||
_order = "sequence"
|
||||
|
||||
@@ -86,20 +88,18 @@ class AccountMassReconcileMethod(models.Model):
|
||||
class AccountMassReconcile(models.Model):
|
||||
_name = "account.mass.reconcile"
|
||||
_inherit = ["mail.thread"]
|
||||
_description = "account mass reconcile"
|
||||
_description = "Account Mass Reconcile"
|
||||
|
||||
@api.multi
|
||||
@api.depends("account")
|
||||
def _get_total_unrec(self):
|
||||
def _compute_total_unrec(self):
|
||||
obj_move_line = self.env["account.move.line"]
|
||||
for rec in self:
|
||||
rec.unreconciled_count = obj_move_line.search_count(
|
||||
[("account_id", "=", rec.account.id), ("reconciled", "=", False)]
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.depends("history_ids")
|
||||
def _last_history(self):
|
||||
def _compute_last_history(self):
|
||||
# do a search() for retrieving the latest history line,
|
||||
# as a read() will badly split the list of ids with 'date desc'
|
||||
# and return the wrong result.
|
||||
@@ -116,7 +116,7 @@ class AccountMassReconcile(models.Model):
|
||||
"account.mass.reconcile.method", "task_id", string="Method"
|
||||
)
|
||||
unreconciled_count = fields.Integer(
|
||||
string="Unreconciled Items", compute="_get_total_unrec"
|
||||
string="Unreconciled Items", compute="_compute_total_unrec"
|
||||
)
|
||||
history_ids = fields.One2many(
|
||||
"mass.reconcile.history", "mass_reconcile_id", string="History", readonly=True
|
||||
@@ -125,7 +125,7 @@ class AccountMassReconcile(models.Model):
|
||||
"mass.reconcile.history",
|
||||
string="Last history",
|
||||
readonly=True,
|
||||
compute="_last_history",
|
||||
compute="_compute_last_history",
|
||||
)
|
||||
company_id = fields.Many2one("res.company", string="Company")
|
||||
|
||||
@@ -143,17 +143,17 @@ class AccountMassReconcile(models.Model):
|
||||
"_filter": rec_method._filter,
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def run_reconcile(self):
|
||||
def find_reconcile_ids(fieldname, move_line_ids):
|
||||
if not move_line_ids:
|
||||
return []
|
||||
sql = (
|
||||
"SELECT DISTINCT " + fieldname + " FROM account_move_line "
|
||||
" WHERE id in %s "
|
||||
" AND " + fieldname + " IS NOT NULL"
|
||||
)
|
||||
self.env.cr.execute(sql, (tuple(move_line_ids),))
|
||||
self.flush()
|
||||
sql = """
|
||||
SELECT DISTINCT %s FROM account_move_line
|
||||
WHERE %s IS NOT NULL AND id in %s
|
||||
"""
|
||||
params = [AsIs(fieldname), AsIs(fieldname), tuple(move_line_ids)]
|
||||
self.env.cr.execute(sql, params)
|
||||
res = self.env.cr.fetchall()
|
||||
return [row[0] for row in res]
|
||||
|
||||
@@ -235,7 +235,6 @@ class AccountMassReconcile(models.Model):
|
||||
"domain": [("id", "in", move_line_ids)],
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def open_unreconcile(self):
|
||||
""" Open the view of move line with the unreconciled move lines"""
|
||||
self.ensure_one()
|
||||
|
||||
@@ -15,9 +15,8 @@ class MassReconcileHistory(models.Model):
|
||||
_rec_name = "mass_reconcile_id"
|
||||
_order = "date DESC"
|
||||
|
||||
@api.multi
|
||||
@api.depends("reconcile_ids")
|
||||
def _get_reconcile_line_ids(self):
|
||||
def _compute_reconcile_line_ids(self):
|
||||
for rec in self:
|
||||
rec.reconcile_line_ids = rec.mapped("reconcile_ids.reconciled_line_ids").ids
|
||||
|
||||
@@ -35,7 +34,7 @@ class MassReconcileHistory(models.Model):
|
||||
comodel_name="account.move.line",
|
||||
relation="account_move_line_history_rel",
|
||||
string="Reconciled Items",
|
||||
compute="_get_reconcile_line_ids",
|
||||
compute="_compute_reconcile_line_ids",
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
"res.company",
|
||||
@@ -45,7 +44,6 @@ class MassReconcileHistory(models.Model):
|
||||
related="mass_reconcile_id.company_id",
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _open_move_lines(self):
|
||||
""" For an history record, open the view of move line with
|
||||
the reconciled move lines
|
||||
@@ -67,7 +65,6 @@ class MassReconcileHistory(models.Model):
|
||||
"domain": [("id", "in", move_line_ids)],
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def open_reconcile(self):
|
||||
""" For an history record, open the view of move line
|
||||
with the reconciled move lines
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
# Copyright 2010 Sébastien Beau
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class MassReconcileSimple(models.AbstractModel):
|
||||
_name = "mass.reconcile.simple"
|
||||
_inherit = "mass.reconcile.base"
|
||||
_description = "Mass Reconcile Simple"
|
||||
|
||||
# has to be subclassed
|
||||
# field name used as key for matching the move lines
|
||||
_key_field = None
|
||||
|
||||
@api.multi
|
||||
def rec_auto_lines_simple(self, lines):
|
||||
if self._key_field is None:
|
||||
raise ValueError("_key_field has to be defined")
|
||||
@@ -67,6 +67,7 @@ class MassReconcileSimple(models.AbstractModel):
|
||||
class MassReconcileSimpleName(models.TransientModel):
|
||||
_name = "mass.reconcile.simple.name"
|
||||
_inherit = "mass.reconcile.simple"
|
||||
_description = "Mass Reconcile Simple Name"
|
||||
|
||||
# has to be subclassed
|
||||
# field name used as key for matching the move lines
|
||||
@@ -76,6 +77,7 @@ class MassReconcileSimpleName(models.TransientModel):
|
||||
class MassReconcileSimplePartner(models.TransientModel):
|
||||
_name = "mass.reconcile.simple.partner"
|
||||
_inherit = "mass.reconcile.simple"
|
||||
_description = "Mass Reconcile Simple Partner"
|
||||
|
||||
# has to be subclassed
|
||||
# field name used as key for matching the move lines
|
||||
@@ -85,6 +87,7 @@ class MassReconcileSimplePartner(models.TransientModel):
|
||||
class MassReconcileSimpleReference(models.TransientModel):
|
||||
_name = "mass.reconcile.simple.reference"
|
||||
_inherit = "mass.reconcile.simple"
|
||||
_description = "Mass Reconcile Simple Reference"
|
||||
|
||||
# has to be subclassed
|
||||
# field name used as key for matching the move lines
|
||||
|
||||
@@ -16,3 +16,4 @@
|
||||
* Damien Crier <damien.crier@camptocamp.com>
|
||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
* Mykhailo Panarin <m.panarin@mobilunity.com>
|
||||
* Adrià Gil Sorribes <adria.gil@forgeflow.com>
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/12.0/account_mass_reconcile"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-reconcile-12-0/account-reconcile-12-0-account_mass_reconcile"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/98/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/13.0/account_mass_reconcile"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-reconcile-13-0/account-reconcile-13-0-account_mass_reconcile"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/98/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This is a shared work between Akretion and Camptocamp
|
||||
in order to provide:</p>
|
||||
<ul class="simple">
|
||||
@@ -410,7 +410,7 @@ reconcile.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-reconcile/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_mass_reconcile%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_mass_reconcile%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -443,6 +443,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>Damien Crier <<a class="reference external" href="mailto:damien.crier@camptocamp.com">damien.crier@camptocamp.com</a>></li>
|
||||
<li>Akim Juillerat <<a class="reference external" href="mailto:akim.juillerat@camptocamp.com">akim.juillerat@camptocamp.com</a>></li>
|
||||
<li>Mykhailo Panarin <<a class="reference external" href="mailto:m.panarin@mobilunity.com">m.panarin@mobilunity.com</a>></li>
|
||||
<li>Adrià Gil Sorribes <<a class="reference external" href="mailto:adria.gil@forgeflow.com">adria.gil@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -452,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/12.0/account_mass_reconcile">OCA/account-reconcile</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/13.0/account_mass_reconcile">OCA/account-reconcile</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
)
|
||||
cls.rec_history_obj = cls.env["mass.reconcile.history"]
|
||||
cls.mass_rec_obj = cls.env["account.mass.reconcile"]
|
||||
cls.invoice_obj = cls.env["account.invoice"]
|
||||
cls.invoice_obj = cls.env["account.move"]
|
||||
cls.bk_stmt_obj = cls.env["account.bank.statement"]
|
||||
cls.bk_stmt_line_obj = cls.env["account.bank.statement.line"]
|
||||
cls.acc_move_line_obj = cls.env["account.move.line"]
|
||||
@@ -45,10 +45,9 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
|
||||
def test_scenario_reconcile(self):
|
||||
# create invoice
|
||||
invoice = self.invoice_obj.create(
|
||||
invoice = self.invoice_obj.with_context(default_type="out_invoice").create(
|
||||
{
|
||||
"type": "out_invoice",
|
||||
"account_id": self.ref("account.a_recv"),
|
||||
"company_id": self.ref("base.main_company"),
|
||||
"journal_id": self.ref("account.sales_journal"),
|
||||
"partner_id": self.ref("base.res_partner_12"),
|
||||
@@ -57,7 +56,7 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": "[PCSC234] PC Assemble SC234",
|
||||
"name": "[FURN_7800] Desk Combination",
|
||||
"account_id": self.ref("account.a_sale"),
|
||||
"price_unit": 1000.0,
|
||||
"quantity": 1.0,
|
||||
@@ -68,8 +67,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
}
|
||||
)
|
||||
# validate invoice
|
||||
invoice.action_invoice_open()
|
||||
self.assertEqual("open", invoice.state)
|
||||
invoice.post()
|
||||
self.assertEqual("posted", invoice.state)
|
||||
|
||||
# create bank_statement
|
||||
statement = self.bk_stmt_obj.create(
|
||||
@@ -85,8 +84,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
{
|
||||
"amount": 1000.0,
|
||||
"partner_id": self.ref("base.res_partner_12"),
|
||||
"name": invoice.number,
|
||||
"ref": invoice.number,
|
||||
"name": invoice.name,
|
||||
"ref": invoice.name,
|
||||
},
|
||||
)
|
||||
],
|
||||
@@ -95,8 +94,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
|
||||
# reconcile
|
||||
line_id = None
|
||||
for l in invoice.move_id.line_ids:
|
||||
if l.account_id.id == self.ref("account.a_recv"):
|
||||
for l in invoice.line_ids:
|
||||
if l.account_id.internal_type == "receivable":
|
||||
line_id = l
|
||||
break
|
||||
|
||||
@@ -107,7 +106,7 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
"move_line": line_id,
|
||||
"credit": 1000.0,
|
||||
"debit": 0.0,
|
||||
"name": invoice.number,
|
||||
"name": invoice.name,
|
||||
}
|
||||
]
|
||||
)
|
||||
@@ -122,13 +121,14 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
mass_rec = self.mass_rec_obj.create(
|
||||
{
|
||||
"name": "mass_reconcile_1",
|
||||
"account": self.ref("account.a_recv"),
|
||||
"account": line_id.account_id.id,
|
||||
"reconcile_method": [(0, 0, {"name": "mass.reconcile.simple.partner"})],
|
||||
}
|
||||
)
|
||||
# call the automatic reconcilation method
|
||||
mass_rec.run_reconcile()
|
||||
self.assertEqual("paid", invoice.state)
|
||||
invoice.invalidate_cache()
|
||||
self.assertEqual("paid", invoice.invoice_payment_state)
|
||||
|
||||
def test_scenario_reconcile_currency(self):
|
||||
# create currency rate
|
||||
@@ -140,20 +140,19 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
}
|
||||
)
|
||||
# create invoice
|
||||
invoice = self.invoice_obj.create(
|
||||
invoice = self.invoice_obj.with_context(default_type="out_invoice").create(
|
||||
{
|
||||
"type": "out_invoice",
|
||||
"account_id": self.ref("account.a_recv"),
|
||||
"company_id": self.ref("base.main_company"),
|
||||
"currency_id": self.ref("base.USD"),
|
||||
"journal_id": self.ref("account.bank_journal_usd"),
|
||||
"journal_id": self.ref("account.sales_journal"),
|
||||
"partner_id": self.ref("base.res_partner_12"),
|
||||
"invoice_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"name": "[PCSC234] PC Assemble SC234",
|
||||
"name": "[FURN_7800] Desk Combination",
|
||||
"account_id": self.ref("account.a_sale"),
|
||||
"price_unit": 1000.0,
|
||||
"quantity": 1.0,
|
||||
@@ -164,8 +163,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
}
|
||||
)
|
||||
# validate invoice
|
||||
invoice.action_invoice_open()
|
||||
self.assertEqual("open", invoice.state)
|
||||
invoice.post()
|
||||
self.assertEqual("posted", invoice.state)
|
||||
|
||||
# create bank_statement
|
||||
statement = self.bk_stmt_obj.create(
|
||||
@@ -183,8 +182,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
"amount": 1000.0,
|
||||
"amount_currency": 1500.0,
|
||||
"partner_id": self.ref("base.res_partner_12"),
|
||||
"name": invoice.number,
|
||||
"ref": invoice.number,
|
||||
"name": invoice.name,
|
||||
"ref": invoice.name,
|
||||
},
|
||||
)
|
||||
],
|
||||
@@ -193,8 +192,8 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
|
||||
# reconcile
|
||||
line_id = None
|
||||
for l in invoice.move_id.line_ids:
|
||||
if l.account_id.id == self.ref("account.a_recv"):
|
||||
for l in invoice.line_ids:
|
||||
if l.account_id.internal_type == "receivable":
|
||||
line_id = l
|
||||
break
|
||||
|
||||
@@ -205,7 +204,7 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
"move_line": line_id,
|
||||
"credit": 1000.0,
|
||||
"debit": 0.0,
|
||||
"name": invoice.number,
|
||||
"name": invoice.name,
|
||||
}
|
||||
]
|
||||
)
|
||||
@@ -219,10 +218,11 @@ class TestScenarioReconcile(common.SavepointCase):
|
||||
mass_rec = self.mass_rec_obj.create(
|
||||
{
|
||||
"name": "mass_reconcile_1",
|
||||
"account": self.ref("account.a_recv"),
|
||||
"account": line_id.account_id.id,
|
||||
"reconcile_method": [(0, 0, {"name": "mass.reconcile.simple.partner"})],
|
||||
}
|
||||
)
|
||||
# call the automatic reconcilation method
|
||||
mass_rec.run_reconcile()
|
||||
self.assertEqual("paid", invoice.state)
|
||||
invoice.invalidate_cache()
|
||||
self.assertEqual("paid", invoice.invoice_payment_state)
|
||||
|
||||
@@ -142,7 +142,6 @@ The lines should have the same partner, and the credit entry ref. is matched wit
|
||||
<field name="name">Mass Automatic Reconcile</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.mass.reconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
<field name="name">Mass Automatic Reconcile History</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mass.reconcile.history</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<act_window
|
||||
|
||||
Reference in New Issue
Block a user