Browse Source

[10.0][account_bank_statement_line_reconciliation][IMP] + Reconcil start

pull/472/head
Tonow-c2c 6 years ago
parent
commit
bbb77e0218
  1. 1
      account_bank_statement_line_reconciliation/__init__.py
  2. 4
      account_bank_statement_line_reconciliation/__manifest__.py
  3. 7
      account_bank_statement_line_reconciliation/models/__init__.py
  4. 58
      account_bank_statement_line_reconciliation/models/account_bank_statement.py
  5. 15
      account_bank_statement_line_reconciliation/models/company.py
  6. 18
      account_bank_statement_line_reconciliation/models/res_config_settings.py
  7. 18
      account_bank_statement_line_reconciliation/views/res_config_settings_views.xml

1
account_bank_statement_line_reconciliation/__init__.py

@ -2,4 +2,5 @@
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from . import wizard

4
account_bank_statement_line_reconciliation/__manifest__.py

@ -11,9 +11,13 @@
'website': 'https://github.com/OCA/account-financial-reporting',
'license': 'AGPL-3',
'depends': [
'account',
'account_accountant',
],
'data': [
# Views
'views/res_config_settings_views.xml',
# Wizard
'wizard/account_bank_statement_line_reconciliation_wizard.xml',
],
'installable': True,

7
account_bank_statement_line_reconciliation/models/__init__.py

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_config_settings
from . import account_bank_statement
from . import company

58
account_bank_statement_line_reconciliation/models/account_bank_statement.py

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from odoo import models, fields, api
from odoo.osv import expression
class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"
def get_move_lines_for_reconciliation(
self, excluded_ids=None, str=False, offset=0, limit=None,
additional_domain=None, overlook_partner=False
):
"""
Change the additional_domain to just see account statement line
with date after 'Bank Reconciliation Threshold' date
"""
additional_domain = additional_domain or []
rec_start = self.env.user.company_id.account_bank_reconciliation_start
if rec_start:
additional_domain.append(('date', '>', rec_start))
return super(
AccountBankStatementLine, self
).get_move_lines_for_reconciliation(
excluded_ids=excluded_ids,
str=str,
offset=offset,
limit=limit,
additional_domain=additional_domain,
overlook_partner=overlook_partner
)
@api.multi
def get_data_for_reconciliation_widget(self, excluded_ids=None):
"""
Keep account bank statement line only if date line is after
'Bank Reconciliation Threshold' date
"""
excluded_ids = excluded_ids or []
rec_start = self.env.user.company_id.account_bank_reconciliation_start
ret = []
acc_bank_st_lines = super(
AccountBankStatementLine, self
).get_data_for_reconciliation_widget(excluded_ids)
if rec_start:
for acc_bank_st_line in acc_bank_st_lines:
st_line_date = acc_bank_st_line['st_line']['date']
if st_line_date > rec_start:
ret.append(acc_bank_st_line)
else:
ret = acc_bank_st_lines
return ret

15
account_bank_statement_line_reconciliation/models/company.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
account_bank_reconciliation_start = fields.Date(
string="Bank Reconciliation Threshold",
help="""The bank reconciliation widget won't ask to reconcile\
payments older than this date.\
This is useful if you install accounting after having used invoicing\
for some time and don't want to reconcile all\
the past payments with bank statements."""
)

18
account_bank_statement_line_reconciliation/models/res_config_settings.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class AccountConfigSettings(models.TransientModel):
_inherit = 'account.config.settings'
account_bank_reconciliation_start = fields.Date(
string="Bank Reconciliation Threshold",
related='company_id.account_bank_reconciliation_start',
readonly=False,
help="""The bank reconciliation widget won't ask to reconcile\
payments older than this date.\
This is useful if you install accounting after having used invoicing\
for some time and don't want to reconcile all the past payments\
with bank statements."""
)

18
account_bank_statement_line_reconciliation/views/res_config_settings_views.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="extra_account_mass_reconcile_view_account_config" model="ir.ui.view">
<field name="name">extra.account.mass.reconcile.view.account.config</field>
<field name="model">account.config.settings</field>
<field name="inherit_id" ref="account_mass_reconcile.view_account_config"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='reconciliation_config']" position="inside">
<div>
<label for="account_bank_reconciliation_start"/>
<field name="account_bank_reconciliation_start" class="oe_inline"/>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save