Update manifest and split readme
Fix breaking typo on model name for reconciliation method Add unittest Add myself to contributorspull/276/head
parent
0824069007
commit
7fbaf65490
|
@ -3,10 +3,10 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
{
|
{
|
||||||
'name': 'Mass Reconcile Transaction Ref',
|
'name': 'Mass Reconcile Transaction Ref',
|
||||||
'version': '10.0.1.0.0',
|
'version': '10.0.1.1.0',
|
||||||
'author': "Camptocamp,Odoo Community Association (OCA)",
|
'author': "Camptocamp,Odoo Community Association (OCA)",
|
||||||
'category': 'Finance',
|
'category': 'Finance',
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'https://github.com/OCA/account-reconcile',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'depends': [
|
'depends': [
|
||||||
'account_mass_reconcile',
|
'account_mass_reconcile',
|
||||||
|
@ -15,9 +15,6 @@
|
||||||
'data': [
|
'data': [
|
||||||
'views/mass_reconcile_view.xml'
|
'views/mass_reconcile_view.xml'
|
||||||
],
|
],
|
||||||
'demo': [],
|
|
||||||
'test': [],
|
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'images': []
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MassReconcileAdvancedTransactionRef(models.TransientModel):
|
||||||
|
|
||||||
class MassReconcileAdvancedTransactionRefVsRef(models.TransientModel):
|
class MassReconcileAdvancedTransactionRefVsRef(models.TransientModel):
|
||||||
|
|
||||||
_name = 'mass.reconcile.advanced.transaction.ref.vs.ref'
|
_name = 'mass.reconcile.advanced.trans_ref_vs_ref'
|
||||||
_inherit = 'mass.reconcile.advanced'
|
_inherit = 'mass.reconcile.advanced'
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|
|
@ -10,8 +10,7 @@ class AccountMassReconcileMethod(models.Model):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_all_rec_method(self):
|
def _get_all_rec_method(self):
|
||||||
_super = super(AccountMassReconcileMethod, self)
|
methods = super(AccountMassReconcileMethod, self)._get_all_rec_method()
|
||||||
methods = _super._get_all_rec_method()
|
|
||||||
methods += [
|
methods += [
|
||||||
('mass.reconcile.advanced.transaction_ref',
|
('mass.reconcile.advanced.transaction_ref',
|
||||||
'Advanced. Partner and Transaction Ref.'),
|
'Advanced. Partner and Transaction Ref.'),
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
* Romain Deheele <romain.deheele@camptocamp.com>
|
||||||
|
* Matthieu Dietrich <matthieu.dietrich@camptocamp.com>
|
||||||
|
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
|
@ -0,0 +1,2 @@
|
||||||
|
This module extends the functionality of account_mass_reconcile
|
||||||
|
to use the 'transaction_ref' field defined in base_transaction_id.
|
|
@ -0,0 +1,117 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2018 Camptocamp SA
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo.tests.common import SavepointCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestAccountReconcileTransactionRef(SavepointCase):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(TestAccountReconcileTransactionRef, cls).setUpClass()
|
||||||
|
|
||||||
|
cls.partner = cls.env.ref('base.res_partner_18')
|
||||||
|
cls.account_receivable = cls.env['account.account'].search([
|
||||||
|
('user_type_id', '=',
|
||||||
|
cls.env.ref('account.data_account_type_receivable').id)
|
||||||
|
], limit=1)
|
||||||
|
account_revenue = cls.env['account.account'].search([
|
||||||
|
('user_type_id', '=',
|
||||||
|
cls.env.ref('account.data_account_type_revenue').id)
|
||||||
|
], limit=1)
|
||||||
|
sales_journal = cls.env['account.journal'].search([
|
||||||
|
('type', '=', 'sale')], limit=1)
|
||||||
|
# Create invoice
|
||||||
|
cls.cust_invoice = cls.env['account.invoice'].create({
|
||||||
|
'partner_id': cls.partner.id,
|
||||||
|
'type': 'out_invoice',
|
||||||
|
'account_id': cls.account_receivable.id,
|
||||||
|
'journal_id': sales_journal.id,
|
||||||
|
'invoice_line_ids': [(0, 0, {
|
||||||
|
'name': '[CONS_DEL01] Server',
|
||||||
|
'product_id': cls.env.ref('product.consu_delivery_01').id,
|
||||||
|
'account_id': account_revenue.id,
|
||||||
|
'price_unit': 1000.0,
|
||||||
|
'quantity': 1.0,
|
||||||
|
})],
|
||||||
|
'transaction_id': 'test_transaction_id',
|
||||||
|
})
|
||||||
|
cls.cust_invoice.action_invoice_open()
|
||||||
|
|
||||||
|
def test_mass_reconcile_transaction_ref_vs_ref(self):
|
||||||
|
self.assertEqual(self.cust_invoice.state, 'open')
|
||||||
|
self.assertEqual(self.cust_invoice.transaction_id,
|
||||||
|
'test_transaction_id')
|
||||||
|
bank_journal = self.env['account.journal'].search([
|
||||||
|
('type', '=', 'sale')], limit=1)
|
||||||
|
|
||||||
|
# Create payment
|
||||||
|
payment = self.env['account.payment'].create({
|
||||||
|
'payment_type': 'inbound',
|
||||||
|
'partner_type': 'customer',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'journal_id': bank_journal.id,
|
||||||
|
'amount': 1000.0,
|
||||||
|
'communication': 'test_transaction_id',
|
||||||
|
'payment_method_id': self.env['account.payment.method'].search([
|
||||||
|
('name', '=', 'Manual')], limit=1).id,
|
||||||
|
})
|
||||||
|
self.assertEqual(payment.state, 'draft')
|
||||||
|
payment.post()
|
||||||
|
self.assertEqual(payment.state, 'posted')
|
||||||
|
|
||||||
|
reconcile = self.env['account.mass.reconcile'].create({
|
||||||
|
'name': 'Test reconcile transaction id',
|
||||||
|
'account': self.account_receivable.id,
|
||||||
|
'reconcile_method': [(0, 0, {
|
||||||
|
'name': 'mass.reconcile.advanced.trans_ref_vs_ref',
|
||||||
|
'date_base_on': 'newest',
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
count = reconcile.unreconciled_count
|
||||||
|
reconcile.run_reconcile()
|
||||||
|
self.assertEqual(self.cust_invoice.state, 'paid')
|
||||||
|
self.assertEqual(reconcile.unreconciled_count, count - 2)
|
||||||
|
|
||||||
|
def test_mass_reconcile_transaction_ref(self):
|
||||||
|
self.assertEqual(self.cust_invoice.state, 'open')
|
||||||
|
self.assertEqual(self.cust_invoice.transaction_id,
|
||||||
|
'test_transaction_id')
|
||||||
|
bank_journal = self.env['account.journal'].search([
|
||||||
|
('type', '=', 'sale')], limit=1)
|
||||||
|
|
||||||
|
# Create payment
|
||||||
|
payment = self.env['account.payment'].create({
|
||||||
|
'payment_type': 'inbound',
|
||||||
|
'partner_type': 'customer',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'journal_id': bank_journal.id,
|
||||||
|
'amount': 1000.0,
|
||||||
|
'communication': 'test_transaction_id',
|
||||||
|
'payment_method_id': self.env['account.payment.method'].search([
|
||||||
|
('name', '=', 'Manual')], limit=1).id,
|
||||||
|
})
|
||||||
|
self.assertEqual(payment.state, 'draft')
|
||||||
|
payment.post()
|
||||||
|
self.assertEqual(payment.state, 'posted')
|
||||||
|
receivable_payment_move_line = self.env['account.move.line'].search([
|
||||||
|
('payment_id', '=', payment.id),
|
||||||
|
('account_id', '=', self.account_receivable.id)
|
||||||
|
])
|
||||||
|
receivable_payment_move_line.write({
|
||||||
|
'transaction_ref': 'test_transaction_id'
|
||||||
|
})
|
||||||
|
|
||||||
|
reconcile = self.env['account.mass.reconcile'].create({
|
||||||
|
'name': 'Test reconcile transaction id',
|
||||||
|
'account': self.account_receivable.id,
|
||||||
|
'reconcile_method': [(0, 0, {
|
||||||
|
'name': 'mass.reconcile.advanced.transaction_ref',
|
||||||
|
'date_base_on': 'newest',
|
||||||
|
})]
|
||||||
|
})
|
||||||
|
count = reconcile.unreconciled_count
|
||||||
|
reconcile.run_reconcile()
|
||||||
|
self.assertEqual(self.cust_invoice.state, 'paid')
|
||||||
|
self.assertEqual(reconcile.unreconciled_count, count - 2)
|
Loading…
Reference in New Issue