Skip to content

Commit 7fd7426

Browse files
committed
[11.0] migation module ricevute bancarie to 11, includes PR 507
1 parent 23e81b2 commit 7fd7426

35 files changed

Lines changed: 766 additions & 804 deletions

l10n_it_ricevute_bancarie/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# © 2016 Andrea Cometa (<http://www.andreacometa.it>)
32
# © 2012 Agile Business Group sagl (<http://www.agilebg.com>)
43
# © 2012 Domsense srl (<http://www.domsense.com>)

l10n_it_ricevute_bancarie/__manifest__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it
@@ -9,32 +8,31 @@
98

109
{
1110
'name': "Ricevute Bancarie",
12-
'version': "10.0.1.1.0",
11+
'version': "11.0.1.0.0",
1312
'author': "Odoo Community Association (OCA)",
1413
'category': "Accounting & Finance",
1514
'website': "https://odoo-community.org/",
1615
'license': "AGPL-3",
1716
'depends': [
18-
'account_accountant',
17+
'account_invoicing',
18+
'account_group_menu',
1919
'l10n_it_fiscalcode',
20-
'account_due_list',
2120
'base_iban',
2221
'l10n_it_abicab'],
2322
'data': [
24-
"views/partner_view.xml",
25-
"views/configuration_view.xml",
26-
"riba_sequence.xml",
23+
"data/riba_sequence.xml",
24+
"report/report.xml",
25+
"security/ir.model.access.csv",
2726
"views/wizard_accreditation.xml",
2827
"views/wizard_unsolved.xml",
2928
"views/riba_view.xml",
3029
"views/account_view.xml",
30+
"views/configuration_view.xml",
31+
"views/partner_view.xml",
3132
"views/wizard_riba_issue.xml",
3233
"views/wizard_riba_file_export.xml",
3334
"views/account_config_view.xml",
34-
"riba_workflow.xml",
3535
"views/distinta_report.xml",
36-
"report.xml",
37-
"security/ir.model.access.csv",
3836
],
3937
'demo': ["demo/riba_demo.xml"],
4038
'installable': True,
File renamed without changes.

l10n_it_ricevute_bancarie/models/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it

l10n_it_ricevute_bancarie/models/account/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it
@@ -8,3 +7,4 @@
87
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
98

109
from . import account
10+
from . import bank_statement

l10n_it_ricevute_bancarie/models/account/account.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it
54
# Copyright (C) 2012 Associazione OpenERP Italia
65
# (<http://www.odoo-italia.org>).
7-
# Copyright (C) 2012-2017 Lorenzo Battistini - Agile Business Group
6+
# Copyright (C) 2012-2018 Lorenzo Battistini - Agile Business Group
87
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
98

109
from odoo import fields, models, api, _
@@ -37,6 +36,16 @@ class ResPartnerBankAdd(models.Model):
3736
help="Identification Code of the Company in the System Interbank")
3837

3938

39+
class AccountMove(models.Model):
40+
_inherit = 'account.move'
41+
riba_accredited_ids = fields.One2many(
42+
'riba.distinta', 'accreditation_move_id', 'Distinte RiBa accredited',
43+
readonly=True)
44+
riba_unsolved_ids = fields.One2many(
45+
'riba.distinta.line', 'unsolved_move_id', 'Distinte RiBa unsolved',
46+
readonly=True)
47+
48+
4049
# se distinta_line_ids == None allora non è stata emessa
4150
class AccountMoveLine(models.Model):
4251
_inherit = "account.move.line"
@@ -88,7 +97,7 @@ def update_paid_riba_lines(self):
8897
if riba_line.state in ['confirmed', 'accredited']:
8998
if riba_line.test_reconciled():
9099
riba_line.state = 'paid'
91-
riba_line.distinta_id.signal_workflow('paid')
100+
riba_line.distinta_id.state = 'paid'
92101

93102
@api.multi
94103
def reconcile(
@@ -272,10 +281,10 @@ def unreconcile_riba_lines(self, riba_lines):
272281
if not riba_line.test_reconciled():
273282
if riba_line.distinta_id.accreditation_move_id:
274283
riba_line.state = 'accredited'
275-
riba_line.distinta_id.signal_workflow('accredited')
284+
riba_line.distinta_id.state = 'accredited'
276285
else:
277286
riba_line.state = 'confirmed'
278-
riba_line.distinta_id.signal_workflow('accepted')
287+
riba_line.distinta_id.state = 'accepted'
279288

280289
@api.multi
281290
def unlink(self):
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2018 Lorenzo Battistini - Agile Business Group
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
from odoo.osv import expression
6+
7+
8+
class AccountBankStatementLine(models.Model):
9+
_inherit = 'account.bank.statement.line'
10+
11+
def get_move_lines_for_reconciliation(
12+
self, excluded_ids=None, str=False, offset=0, limit=None,
13+
additional_domain=None, overlook_partner=False
14+
):
15+
res = super(
16+
AccountBankStatementLine, self
17+
).get_move_lines_for_reconciliation(
18+
excluded_ids=excluded_ids, str=str, offset=offset, limit=limit,
19+
additional_domain=additional_domain,
20+
overlook_partner=overlook_partner
21+
)
22+
23+
reconciliation_aml_accounts = [
24+
self.journal_id.default_credit_account_id.id,
25+
self.journal_id.default_debit_account_id.id
26+
]
27+
ctx = dict(self._context or {})
28+
ctx['bank_statement_line'] = self
29+
generic_domain = self.env['account.move.line'].with_context(
30+
ctx
31+
).domain_move_lines_for_reconciliation(
32+
excluded_ids=excluded_ids, str=str)
33+
34+
# Include move lines without payment_id but linked to a RiBa distinta
35+
# in order to allow to close bank statement lines with accreditation
36+
# journal items
37+
accr_domain = [
38+
'&',
39+
'&',
40+
'&',
41+
('move_id.riba_accredited_ids', '!=', False),
42+
('payment_id', '=', False),
43+
('statement_id', '=', False),
44+
('account_id', 'in', reconciliation_aml_accounts),
45+
]
46+
accr_domain = expression.AND([accr_domain, generic_domain])
47+
accr_res = self.env['account.move.line'].search(
48+
accr_domain, offset=offset, limit=limit,
49+
order="date_maturity asc, id asc")
50+
51+
# Include move lines without payment_id but linked to a RiBa distinta
52+
# in order to allow to close bank statement lines with unsolved
53+
# journal items
54+
unsolved_domain = [
55+
'&',
56+
'&',
57+
'&',
58+
('move_id.riba_unsolved_ids', '!=', False),
59+
('payment_id', '=', False),
60+
('statement_id', '=', False),
61+
('account_id', 'in', reconciliation_aml_accounts),
62+
]
63+
unsolved_domain = expression.AND([unsolved_domain, generic_domain])
64+
unsolved_res = self.env['account.move.line'].search(
65+
unsolved_domain, offset=offset, limit=limit,
66+
order="date_maturity asc, id asc")
67+
68+
res = accr_res | unsolved_res | res
69+
return res

l10n_it_ricevute_bancarie/models/account_config.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it
@@ -7,12 +6,12 @@
76
# Copyright (C) 2012-2017 Lorenzo Battistini - Agile Business Group
87
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
98

10-
from openerp import models, fields, api
9+
from odoo import models, fields, api
1110

1211

13-
class AccountConfigSettings(models.TransientModel):
12+
class ResConfigSettings(models.TransientModel):
1413

15-
_inherit = 'account.config.settings'
14+
_inherit = 'res.config.settings'
1615

1716
due_cost_service_id = fields.Many2one(
1817
related='company_id.due_cost_service_id',
@@ -21,7 +20,7 @@ class AccountConfigSettings(models.TransientModel):
2120

2221
@api.model
2322
def default_get(self, fields):
24-
res = super(AccountConfigSettings, self).default_get(fields)
23+
res = super(ResConfigSettings, self).default_get(fields)
2524
if res:
2625
res[
2726
'due_cost_service_id'

l10n_it_ricevute_bancarie/models/partner/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it

l10n_it_ricevute_bancarie/models/partner/partner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright (C) 2012 Andrea Cometa.
32
# Email: info@andreacometa.it
43
# Web site: http://www.andreacometa.it

0 commit comments

Comments
 (0)