[FIX] account: the account.move.line.reconcile is not used anymore so remove it
This commit is contained in:
@@ -24,7 +24,6 @@ You could use this simplified accounting in case you work with an (external) acc
|
||||
'data/digest_data.xml',
|
||||
'views/account_menuitem.xml',
|
||||
'views/account_payment_view.xml',
|
||||
'wizard/account_reconcile_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'wizard/account_move_reversal_view.xml',
|
||||
'views/account_view.xml',
|
||||
|
||||
@@ -393,9 +393,8 @@ class TestReconciliation(AccountingTestCase):
|
||||
move_ids = []
|
||||
for name, amount, amount_currency, currency_id in move_list_vals:
|
||||
move_ids.append(create_move(name, amount, amount_currency, currency_id))
|
||||
aml_recs = self.env['account.move.line'].search([('move_id', 'in', move_ids), ('account_id', '=', self.account_rcv.id)])
|
||||
wizard = self.env['account.move.line.reconcile'].with_context(active_ids=[x.id for x in aml_recs]).create({})
|
||||
wizard.trans_rec_reconcile_full()
|
||||
aml_recs = self.env['account.move.line'].search([('move_id', 'in', move_ids), ('account_id', '=', self.account_rcv.id), ('reconciled', '=', False)])
|
||||
aml_recs.reconcile()
|
||||
for aml in aml_recs:
|
||||
self.assertTrue(aml.reconciled, 'The journal item should be totally reconciled')
|
||||
self.assertEquals(aml.amount_residual, 0, 'The journal item should be totally reconciled')
|
||||
@@ -411,9 +410,8 @@ class TestReconciliation(AccountingTestCase):
|
||||
move_ids = []
|
||||
for name, amount, amount_currency, currency_id in move_list_vals:
|
||||
move_ids.append(create_move(name, amount, amount_currency, currency_id))
|
||||
aml_recs = self.env['account.move.line'].search([('move_id', 'in', move_ids), ('account_id', '=', self.account_rcv.id)])
|
||||
wizard = self.env['account.move.line.reconcile.writeoff'].with_context(active_ids=[x.id for x in aml_recs]).create({'journal_id': self.bank_journal_usd.id, 'writeoff_acc_id': self.account_rsa.id})
|
||||
wizard.trans_rec_reconcile()
|
||||
aml_recs = self.env['account.move.line'].search([('move_id', 'in', move_ids), ('account_id', '=', self.account_rcv.id), ('reconciled', '=', False)])
|
||||
aml_recs.reconcile(self.account_rsa, self.bank_journal_usd)
|
||||
for aml in aml_recs:
|
||||
self.assertTrue(aml.reconciled, 'The journal item should be totally reconciled')
|
||||
self.assertEquals(aml.amount_residual, 0, 'The journal item should be totally reconciled')
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
from . import account_reconcile
|
||||
from . import account_unreconcile
|
||||
from . import account_invoice_refund
|
||||
from . import account_invoice_state
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.tools.float_utils import float_round
|
||||
|
||||
|
||||
class AccountMoveLineReconcile(models.TransientModel):
|
||||
"""
|
||||
Account move line reconcile wizard, it checks for the write off the reconcile entry or directly reconcile.
|
||||
"""
|
||||
_name = 'account.move.line.reconcile'
|
||||
_description = 'Account move line reconcile'
|
||||
|
||||
trans_nbr = fields.Integer(string='Transaction Count', readonly=True)
|
||||
credit = fields.Float(string='Credit amount', readonly=True, digits=0)
|
||||
debit = fields.Float(string='Debit amount', readonly=True, digits=0)
|
||||
writeoff = fields.Float(string='Write-Off amount', readonly=True, digits=0)
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.user.company_id)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(AccountMoveLineReconcile, self).default_get(fields)
|
||||
data = self.trans_rec_get()
|
||||
if 'trans_nbr' in fields:
|
||||
res.update({'trans_nbr': data['trans_nbr']})
|
||||
if 'credit' in fields:
|
||||
res.update({'credit': data['credit']})
|
||||
if 'debit' in fields:
|
||||
res.update({'debit': data['debit']})
|
||||
if 'writeoff' in fields:
|
||||
res.update({'writeoff': data['writeoff']})
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def trans_rec_get(self):
|
||||
context = self._context or {}
|
||||
credit = debit = 0
|
||||
lines = self.env['account.move.line'].browse(context.get('active_ids', []))
|
||||
for line in lines:
|
||||
if not line.full_reconcile_id:
|
||||
credit += line.credit
|
||||
debit += line.debit
|
||||
precision = self.env.user.company_id.currency_id.decimal_places
|
||||
writeoff = float_round(debit - credit, precision_digits=precision)
|
||||
credit = float_round(credit, precision_digits=precision)
|
||||
debit = float_round(debit, precision_digits=precision)
|
||||
return {'trans_nbr': len(lines), 'credit': credit, 'debit': debit, 'writeoff': writeoff}
|
||||
|
||||
@api.multi
|
||||
def trans_rec_addendum_writeoff(self):
|
||||
return self.env['account.move.line.reconcile.writeoff'].trans_rec_addendum()
|
||||
|
||||
@api.multi
|
||||
def trans_rec_reconcile_partial_reconcile(self):
|
||||
return self.env['account.move.line.reconcile.writeoff'].trans_rec_reconcile_partial()
|
||||
|
||||
@api.multi
|
||||
def trans_rec_reconcile_full(self):
|
||||
move_lines = self.env['account.move.line'].browse(self._context.get('active_ids', []))
|
||||
#Don't consider entries that are already reconciled
|
||||
move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled)
|
||||
move_lines_filtered.reconcile()
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
class AccountMoveLineReconcileWriteoff(models.TransientModel):
|
||||
"""
|
||||
It opens the write off wizard form, in that user can define the journal, account, analytic account for reconcile
|
||||
"""
|
||||
_name = 'account.move.line.reconcile.writeoff'
|
||||
_description = 'Account move line reconcile (writeoff)'
|
||||
|
||||
journal_id = fields.Many2one('account.journal', string='Write-Off Journal', required=True)
|
||||
writeoff_acc_id = fields.Many2one('account.account', string='Write-Off account', required=True, domain=[('deprecated', '=', False)])
|
||||
date_p = fields.Date(string='Date', default=fields.Date.context_today)
|
||||
comment = fields.Char(required=True, default='Write-off')
|
||||
analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
|
||||
|
||||
@api.multi
|
||||
def trans_rec_addendum(self):
|
||||
view = self.env.ref('account.account_move_line_reconcile_writeoff')
|
||||
return {
|
||||
'name': _('Reconcile Writeoff'),
|
||||
'context': self._context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'account.move.line.reconcile.writeoff',
|
||||
'views': [(view.id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def trans_rec_reconcile_partial(self):
|
||||
context = self._context or {}
|
||||
self.env['account.move.line'].browse(context.get('active_ids', [])).reconcile()
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def trans_rec_reconcile(self):
|
||||
context = dict(self._context or {})
|
||||
context['date_p'] = self.date_p
|
||||
context['comment'] = self.comment
|
||||
if self.analytic_id:
|
||||
context['analytic_id'] = self.analytic_id.id
|
||||
move_lines = self.env['account.move.line'].browse(self._context.get('active_ids', []))
|
||||
#Don't consider entries that are already reconciled
|
||||
move_lines_filtered = move_lines.filtered(lambda aml: not aml.reconciled)
|
||||
writeoff = move_lines_filtered.with_context(context).reconcile(self.writeoff_acc_id, self.journal_id)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_account_move_line_reconcile_full" model="ir.ui.view">
|
||||
<field name="name">account.move.line.reconcile.full.form</field>
|
||||
<field name="model">account.move.line.reconcile</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reconciliation">
|
||||
<group col="4" string="Reconciliation Transactions">
|
||||
<field name="trans_nbr"/>
|
||||
<newline/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
</group><group string="Write-Off">
|
||||
<field name="writeoff"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Reconcile" name="trans_rec_reconcile_full" type="object" default_focus="1" attrs="{'invisible':[('writeoff','!=',0)]}" class="btn-primary"/>
|
||||
<button string="Reconcile With Write-Off" name="trans_rec_addendum_writeoff" type="object" attrs="{'invisible':[('writeoff','=',0)]}" class="btn-primary"/>
|
||||
<button string="Partial Reconcile" name="trans_rec_reconcile_partial_reconcile" type="object" attrs="{'invisible':['|',('writeoff','=',0),('trans_nbr','<',2)]}" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_move_line_reconcile" model="ir.actions.client">
|
||||
<field name="name">Reconcile Entries</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
<field name="binding_model_id" ref="account.model_account_move_line"/>
|
||||
<field name="binding_type">action</field>
|
||||
</record>
|
||||
|
||||
<record id="account_move_line_reconcile_writeoff" model="ir.ui.view">
|
||||
<field name="name">account.move.line.reconcile.writeoff.form</field>
|
||||
<field name="model">account.move.line.reconcile.writeoff</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Information addendum">
|
||||
<group string="Write-Off Move" col="4">
|
||||
<field name="journal_id"/>
|
||||
<field name="writeoff_acc_id"/>
|
||||
<field name="date_p"/>
|
||||
<field name="comment"/>
|
||||
<field name="analytic_id" groups="analytic.group_analytic_accounting"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Reconcile" name="trans_rec_reconcile" type="object" default_focus="1" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user