odoo-addon-l10n-it-riba-oca 18.0.1.0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. odoo/addons/l10n_it_riba_oca/README.rst +175 -0
  2. odoo/addons/l10n_it_riba_oca/__init__.py +9 -0
  3. odoo/addons/l10n_it_riba_oca/__manifest__.py +59 -0
  4. odoo/addons/l10n_it_riba_oca/data/riba_sequence.xml +14 -0
  5. odoo/addons/l10n_it_riba_oca/demo/riba_demo.xml +39 -0
  6. odoo/addons/l10n_it_riba_oca/hooks.py +17 -0
  7. odoo/addons/l10n_it_riba_oca/i18n/it.po +1686 -0
  8. odoo/addons/l10n_it_riba_oca/i18n/l10n_it_riba.pot +1573 -0
  9. odoo/addons/l10n_it_riba_oca/i18n/l10n_it_riba_oca.pot +1554 -0
  10. odoo/addons/l10n_it_riba_oca/migrations/18.0.1.0.0/pre-migrate.py +16 -0
  11. odoo/addons/l10n_it_riba_oca/models/__init__.py +14 -0
  12. odoo/addons/l10n_it_riba_oca/models/account.py +563 -0
  13. odoo/addons/l10n_it_riba_oca/models/account_config.py +35 -0
  14. odoo/addons/l10n_it_riba_oca/models/ir_ui_menu.py +27 -0
  15. odoo/addons/l10n_it_riba_oca/models/partner.py +35 -0
  16. odoo/addons/l10n_it_riba_oca/models/riba.py +560 -0
  17. odoo/addons/l10n_it_riba_oca/models/riba_config.py +120 -0
  18. odoo/addons/l10n_it_riba_oca/readme/CONFIGURE.md +33 -0
  19. odoo/addons/l10n_it_riba_oca/readme/CONTRIBUTORS.md +17 -0
  20. odoo/addons/l10n_it_riba_oca/readme/DESCRIPTION.md +3 -0
  21. odoo/addons/l10n_it_riba_oca/readme/USAGE.md +35 -0
  22. odoo/addons/l10n_it_riba_oca/report/__init__.py +4 -0
  23. odoo/addons/l10n_it_riba_oca/report/report.xml +16 -0
  24. odoo/addons/l10n_it_riba_oca/report/slip_qweb.py +18 -0
  25. odoo/addons/l10n_it_riba_oca/security/ir.model.access.csv +23 -0
  26. odoo/addons/l10n_it_riba_oca/security/riba_security.xml +34 -0
  27. odoo/addons/l10n_it_riba_oca/static/description/icon.png +0 -0
  28. odoo/addons/l10n_it_riba_oca/static/description/index.html +512 -0
  29. odoo/addons/l10n_it_riba_oca/tests/__init__.py +10 -0
  30. odoo/addons/l10n_it_riba_oca/tests/riba_common.py +339 -0
  31. odoo/addons/l10n_it_riba_oca/tests/test_account_move.py +54 -0
  32. odoo/addons/l10n_it_riba_oca/tests/test_menu.py +51 -0
  33. odoo/addons/l10n_it_riba_oca/tests/test_riba.py +905 -0
  34. odoo/addons/l10n_it_riba_oca/views/account_config_view.xml +46 -0
  35. odoo/addons/l10n_it_riba_oca/views/account_view.xml +205 -0
  36. odoo/addons/l10n_it_riba_oca/views/configuration_view.xml +94 -0
  37. odoo/addons/l10n_it_riba_oca/views/partner_view.xml +29 -0
  38. odoo/addons/l10n_it_riba_oca/views/riba_detail_view.xml +97 -0
  39. odoo/addons/l10n_it_riba_oca/views/riba_view.xml +296 -0
  40. odoo/addons/l10n_it_riba_oca/views/slip_report.xml +149 -0
  41. odoo/addons/l10n_it_riba_oca/views/wizard_credit.xml +46 -0
  42. odoo/addons/l10n_it_riba_oca/views/wizard_due_date_settlement.xml +37 -0
  43. odoo/addons/l10n_it_riba_oca/views/wizard_past_due.xml +67 -0
  44. odoo/addons/l10n_it_riba_oca/views/wizard_presentation.xml +48 -0
  45. odoo/addons/l10n_it_riba_oca/views/wizard_riba_file_export.xml +33 -0
  46. odoo/addons/l10n_it_riba_oca/views/wizard_riba_issue.xml +46 -0
  47. odoo/addons/l10n_it_riba_oca/views/wizard_riba_payment_date.xml +45 -0
  48. odoo/addons/l10n_it_riba_oca/wizard/__init__.py +16 -0
  49. odoo/addons/l10n_it_riba_oca/wizard/wizard_credit.py +280 -0
  50. odoo/addons/l10n_it_riba_oca/wizard/wizard_due_date_settlement.py +24 -0
  51. odoo/addons/l10n_it_riba_oca/wizard/wizard_past_due.py +319 -0
  52. odoo/addons/l10n_it_riba_oca/wizard/wizard_presentation_riba.py +47 -0
  53. odoo/addons/l10n_it_riba_oca/wizard/wizard_riba_file_export.py +429 -0
  54. odoo/addons/l10n_it_riba_oca/wizard/wizard_riba_issue.py +143 -0
  55. odoo/addons/l10n_it_riba_oca/wizard/wizard_riba_multiple_payment.py +107 -0
  56. odoo/addons/l10n_it_riba_oca/wizard/wizard_riba_multiple_payment_views.xml +46 -0
  57. odoo/addons/l10n_it_riba_oca/wizard/wizard_riba_payment_date.py +31 -0
  58. odoo_addon_l10n_it_riba_oca-18.0.1.0.0.8.dist-info/METADATA +197 -0
  59. odoo_addon_l10n_it_riba_oca-18.0.1.0.0.8.dist-info/RECORD +61 -0
  60. odoo_addon_l10n_it_riba_oca-18.0.1.0.0.8.dist-info/WHEEL +5 -0
  61. odoo_addon_l10n_it_riba_oca-18.0.1.0.0.8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2023 Simone Rubino - Aion Tech
4
+ ~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
5
+ -->
6
+ <odoo>
7
+ <record id="wizard_riba_file_export" model="ir.ui.view">
8
+ <field name="name">Export RiBa</field>
9
+ <field name="model">riba.file.export</field>
10
+ <field name="arch" type="xml">
11
+ <form string="Export RiBa file">
12
+ <group col="4">
13
+ <group colspan="4">
14
+ <field name="riba_txt" readonly="1" filename="file_name" />
15
+ <field name="file_name" invisible="1" />
16
+ </group>
17
+ <footer colspan="4">
18
+ <button name="act_getfile" string="Export" type="object" />
19
+ <button special="cancel" string="Close" />
20
+ </footer>
21
+ </group>
22
+ </form>
23
+ </field>
24
+ </record>
25
+
26
+ <record id="action_wizard_riba_file_export" model="ir.actions.server">
27
+ <field name="name">Export RiBa</field>
28
+ <field name="model_id" ref="l10n_it_riba_oca.model_riba_slip" />
29
+ <field name="binding_model_id" ref="l10n_it_riba_oca.model_riba_slip" />
30
+ <field name="state">code</field>
31
+ <field name="code">action = records.action_riba_export()</field>
32
+ </record>
33
+ </odoo>
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2023 Simone Rubino - Aion Tech
4
+ ~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
5
+ -->
6
+ <odoo>
7
+ <!-- ====================================================== -->
8
+ <!-- WIZARD EMISSIONE RIBA -->
9
+ <!-- ====================================================== -->
10
+ <record id="riba_issue_view" model="ir.ui.view">
11
+ <field name="name">riba.issue.wizard</field>
12
+ <field name="model">riba.issue</field>
13
+ <field name="arch" type="xml">
14
+ <form string="RiBa Issue">
15
+ <separator
16
+ string="This wizard will generate the RiBa slip"
17
+ colspan="4"
18
+ />
19
+ <group>
20
+ <field name="configuration_id" />
21
+ </group>
22
+ <footer>
23
+ <button
24
+ string="Create"
25
+ name="create_list"
26
+ type="object"
27
+ default_focus="1"
28
+ class="oe_highlight"
29
+ />
30
+ <button string="Cancel" special="cancel" class="oe_link" />
31
+ </footer>
32
+ </form>
33
+ </field>
34
+ </record>
35
+
36
+ <!-- ====================================================== -->
37
+ <!-- ACTION EMISSIONE RIBA -->
38
+ <!-- ====================================================== -->
39
+ <record id="riba_issue_action_server" model="ir.actions.server">
40
+ <field name="name">Issue RiBa</field>
41
+ <field name="model_id" ref="account.model_account_move_line" />
42
+ <field name="binding_model_id" ref="account.model_account_move_line" />
43
+ <field name="state">code</field>
44
+ <field name="code">action = records.action_riba_issue()</field>
45
+ </record>
46
+ </odoo>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2024 Nextev Srl
4
+ ~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
5
+ -->
6
+ <odoo>
7
+ <record id="wizard_riba_payment_date" model="ir.ui.view">
8
+ <field name="name">Set RiBa Payment Date</field>
9
+ <field name="model">riba.payment.date</field>
10
+ <field name="arch" type="xml">
11
+ <form string="Set RiBa Payment Date">
12
+ <group col="4">
13
+ <group colspan="4">
14
+ <field name="date" />
15
+ </group>
16
+ <footer colspan="4">
17
+ <button
18
+ name="set_riba_payment_date"
19
+ string="Confirm"
20
+ type="object"
21
+ />
22
+ <button special="cancel" string="Close" />
23
+ <separator
24
+ string="You can also skip this step and set the slip status to 'Credited' anyway"
25
+ colspan="4"
26
+ />
27
+ <button
28
+ string="Skip and Confirm Payment"
29
+ name="skip"
30
+ type="object"
31
+ />
32
+ </footer>
33
+ </group>
34
+ </form>
35
+ </field>
36
+ </record>
37
+
38
+ <record id="action_riba_payment_date" model="ir.actions.server">
39
+ <field name="name">RiBa Payment Date</field>
40
+ <field name="model_id" ref="account.model_account_move" />
41
+ <field name="binding_model_id" ref="account.model_account_move" />
42
+ <field name="state">code</field>
43
+ <field name="code">action = records.action_riba_payment_date()</field>
44
+ </record>
45
+ </odoo>
@@ -0,0 +1,16 @@
1
+ # Copyright (C) 2012 Andrea Cometa.
2
+ # Email: info@andreacometa.it
3
+ # Web site: http://www.andreacometa.it
4
+ # Copyright (C) 2012 Associazione OpenERP Italia
5
+ # (<http://www.odoo-italia.org>).
6
+ # Copyright (C) 2012-2017 Lorenzo Battistini - Agile Business Group
7
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
8
+
9
+ from . import wizard_riba_issue
10
+ from . import wizard_riba_file_export
11
+ from . import wizard_riba_payment_date
12
+ from . import wizard_credit
13
+ from . import wizard_past_due
14
+ from . import wizard_presentation_riba
15
+ from . import wizard_riba_multiple_payment
16
+ from . import wizard_due_date_settlement
@@ -0,0 +1,280 @@
1
+ # Copyright (C) 2012 Andrea Cometa.
2
+ # Email: info@andreacometa.it
3
+ # Web site: http://www.andreacometa.it
4
+ # Copyright (C) 2012 Associazione OpenERP Italia
5
+ # (<http://www.odoo-italia.org>).
6
+ # Copyright (C) 2012-2017 Lorenzo Battistini - Agile Business Group
7
+ # Copyright 2023 Simone Rubino - Aion Tech
8
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
9
+
10
+ from odoo import api, fields, models
11
+ from odoo.exceptions import UserError
12
+
13
+
14
+ class RibaCredit(models.TransientModel):
15
+ """
16
+ Wizard for creating bank credit entries for RiBa slips.
17
+
18
+ This wizard handles the "credit" phase of the RiBa collection process, where
19
+ the bank provides immediate liquidity to the company by crediting their account
20
+ with the RiBa amount. This typically happens after the bank accepts the RiBa
21
+ collection but before the actual customer payment is received.
22
+
23
+ RiBa Credit Process:
24
+ 1. Bank accepts RiBa collection from company
25
+ 2. Bank may immediately credit company's account (this wizard)
26
+ 3. Bank collects payment from customers
27
+ 4. If customer pays: settlement completes the cycle
28
+ 5. If customer doesn't pay: past due process reverses the credit
29
+
30
+ Accounting Impact:
31
+ - Increases RiBa Credit Account (asset)
32
+ - Decreases Acceptance Account (liability)
33
+ - Optional: Records bank fees and payment
34
+ """
35
+
36
+ @api.model
37
+ def _get_credit_journal_id(self):
38
+ """Get default credit journal from RiBa configuration."""
39
+ return self.env["riba.configuration"].get_default_value_by_list(
40
+ "credit_journal_id"
41
+ )
42
+
43
+ @api.model
44
+ def _get_credit_account_id(self):
45
+ """Get default RiBa credit account from configuration."""
46
+ return self.env["riba.configuration"].get_default_value_by_list(
47
+ "credit_account_id"
48
+ )
49
+
50
+ @api.model
51
+ def _get_acceptance_account_id(self):
52
+ """Get default acceptance account from RiBa configuration."""
53
+ return self.env["riba.configuration"].get_default_value_by_list(
54
+ "acceptance_account_id"
55
+ )
56
+
57
+ @api.model
58
+ def _get_bank_account_id(self):
59
+ """Get default bank account for fee payments from configuration."""
60
+ return self.env["riba.configuration"].get_default_value_by_list(
61
+ "bank_account_id"
62
+ )
63
+
64
+ @api.model
65
+ def _get_bank_expense_account_id(self):
66
+ """Get default bank expense account for collection fees."""
67
+ return self.env["riba.configuration"].get_default_value_by_list(
68
+ "bank_expense_account_id"
69
+ )
70
+
71
+ @api.model
72
+ def _get_acceptance_amount(self):
73
+ """
74
+ Calculate total acceptance amount from RiBa slip lines.
75
+
76
+ This represents the total amount that was originally recorded
77
+ in the acceptance phase and needs to be reversed during credit.
78
+
79
+ :return: Total amount of all lines in the active RiBa slip
80
+ :rtype: float
81
+ """
82
+ if not self.env.context.get("active_id", False):
83
+ return False
84
+ slip_model = self.env["riba.slip"]
85
+ slip = slip_model.browse(self.env.context["active_id"])
86
+ amount = 0.0
87
+ # Sum all line amounts to get total RiBa value
88
+ for line in slip.line_ids:
89
+ amount += line.amount
90
+ return amount
91
+
92
+ _name = "riba.credit"
93
+ _description = "Bank Credit Wizard for RiBa Collections"
94
+
95
+ # Journal and account configuration fields
96
+ credit_journal_id = fields.Many2one(
97
+ "account.journal",
98
+ string="Credit Journal",
99
+ default=_get_credit_journal_id,
100
+ )
101
+ credit_account_id = fields.Many2one(
102
+ "account.account",
103
+ string="RiBa Credit Account",
104
+ default=_get_credit_account_id,
105
+ help="Asset account representing amounts credited by the bank. "
106
+ "This will be debited with the credit amount.",
107
+ )
108
+ credit_amount = fields.Float(
109
+ help="Amount the bank is crediting to the company. ",
110
+ )
111
+
112
+ # Acceptance account configuration
113
+ acceptance_account_id = fields.Many2one(
114
+ "account.account",
115
+ string="Acceptance Account",
116
+ default=_get_acceptance_account_id,
117
+ help="Liability account used during RiBa acceptance. "
118
+ "This will be credited to reverse the acceptance entry.",
119
+ )
120
+ acceptance_amount = fields.Float(
121
+ default=_get_acceptance_amount,
122
+ help="Total amount from the RiBa slip that was recorded during acceptance. "
123
+ "This amount will be used to reverse the acceptance liability.",
124
+ )
125
+
126
+ # Bank account and fee configuration
127
+ bank_account_id = fields.Many2one(
128
+ "account.account",
129
+ string="Bank Account",
130
+ default=_get_bank_account_id,
131
+ help="Bank account from which collection fees will be paid. "
132
+ "This account will be credited for any expense amounts.",
133
+ )
134
+ bank_expense_account_id = fields.Many2one(
135
+ "account.account",
136
+ string="Bank Fees Account",
137
+ default=_get_bank_expense_account_id,
138
+ help="Expense account for recording bank collection fees. "
139
+ "This account will be debited for any fees charged by the bank.",
140
+ )
141
+ expense_amount = fields.Float(
142
+ string="Bank Fees Amount",
143
+ help="Amount of fees charged by the bank for the RiBa collection service. "
144
+ "If specified, separate entries will be created for the fee payment.",
145
+ )
146
+
147
+ def create_move(self):
148
+ """
149
+ Create bank credit accounting move for RiBa slip.
150
+
151
+ This method handles the bank credit phase of the RiBa process, where the bank
152
+ credits the company's account with the RiBa amount (minus any fees). This
153
+ typically happens when the bank accepts the RiBa collection and provides
154
+ immediate liquidity to the company.
155
+
156
+ Accounting Flow:
157
+ 1. Debit RiBa Account (asset) - Amount the bank will collect
158
+ 2. Credit Acceptance Account (liability) - Offset the acceptance entry
159
+ 3. Optional: Debit Bank Fees (expense) - Bank collection fees
160
+ 4. Optional: Credit Bank Account (asset) - Fees paid from bank account
161
+
162
+ Business Context:
163
+ - After RiBa acceptance, bank may credit company account immediately
164
+ - Company receives liquidity but bank retains collection risk
165
+ - If customer doesn't pay, bank may reverse the credit (past due)
166
+
167
+ :return: Action to display the created accounting move
168
+ :rtype: dict
169
+ :raises UserError: If required accounts are not configured or active_id missing
170
+ """
171
+ # Validate context and get the RiBa slip
172
+ active_id = self.env.context.get("active_id", False)
173
+ if not active_id:
174
+ raise UserError(self.env._("No active ID found."))
175
+
176
+ # Initialize models and get the RiBa slip
177
+ move_model = self.env["account.move"]
178
+ slip_model = self.env["riba.slip"]
179
+ slip = slip_model.browse(active_id)
180
+ wizard = self
181
+
182
+ # Validate all required accounts are configured
183
+ # This ensures the accounting entries can be created properly
184
+ if (
185
+ not wizard.credit_journal_id
186
+ or not wizard.credit_account_id
187
+ or not wizard.acceptance_account_id
188
+ or not wizard.bank_account_id
189
+ or not wizard.bank_expense_account_id
190
+ ):
191
+ raise UserError(self.env._("Every account is mandatory."))
192
+
193
+ # Prepare the basic credit move with core RiBa entries
194
+ move_vals = {
195
+ "ref": self.env._("RiBa Credit %s") % slip.name,
196
+ "journal_id": wizard.credit_journal_id.id,
197
+ "line_ids": [
198
+ # Debit RiBa Credit Account - Represents amount bank will collect
199
+ (
200
+ 0,
201
+ 0,
202
+ {
203
+ "name": self.env._("Credit"),
204
+ "account_id": wizard.credit_account_id.id,
205
+ "credit": 0.0,
206
+ "debit": wizard.credit_amount, # Amount bank credits to us
207
+ },
208
+ ),
209
+ # Credit Acceptance Account - Reverses the acceptance liability
210
+ (
211
+ 0,
212
+ 0,
213
+ {
214
+ "name": self.env._("Acceptance Account"),
215
+ "account_id": wizard.acceptance_account_id.id,
216
+ "debit": 0.0,
217
+ "credit": wizard.acceptance_amount, # Offset acceptance entry
218
+ },
219
+ ),
220
+ ],
221
+ }
222
+
223
+ # Add bank fee entries if applicable
224
+ # Banks often charge fees for RiBa collection services
225
+ if wizard.expense_amount:
226
+ move_vals["line_ids"].extend(
227
+ [
228
+ # Debit Bank Fees - Record collection expense
229
+ (
230
+ 0,
231
+ 0,
232
+ {
233
+ "name": self.env._("Bank Fee"),
234
+ "account_id": wizard.bank_expense_account_id.id,
235
+ "debit": wizard.expense_amount, # Fee amount charged
236
+ "credit": 0.0,
237
+ },
238
+ ),
239
+ # Credit Bank Account - Payment of fees from bank balance
240
+ (
241
+ 0,
242
+ 0,
243
+ {
244
+ "name": self.env._("Bank Account"),
245
+ "account_id": wizard.bank_account_id.id,
246
+ "debit": 0.0,
247
+ "credit": wizard.expense_amount, # Reduce bank balance
248
+ },
249
+ ),
250
+ ]
251
+ )
252
+
253
+ # Create the accounting move
254
+ move = move_model.create(move_vals)
255
+
256
+ # Update RiBa slip to credited state
257
+ vals = {
258
+ "credit_move_id": move.id, # Link the credit move to the slip
259
+ "state": "credited", # Mark slip as credited by bank
260
+ }
261
+ # Set credit date if not already set
262
+ if not slip.date_credited:
263
+ vals.update({"date_credited": fields.Date.context_today(self)})
264
+ slip.update(vals)
265
+
266
+ # Update all RiBa lines to credited state
267
+ # This indicates the bank has provided credit for these collections
268
+ for line in slip.line_ids:
269
+ line.state = "credited"
270
+ line.credit_move_id = move # Link credit move to each line
271
+
272
+ # Return action to display the created move
273
+ return {
274
+ "name": self.env._("Credit Entry"),
275
+ "view_mode": "form",
276
+ "res_model": "account.move",
277
+ "type": "ir.actions.act_window",
278
+ "target": "current",
279
+ "res_id": move.id or False,
280
+ }
@@ -0,0 +1,24 @@
1
+ # Copyright (C) 2024 Giuseppe Borruso - Dinamiche Aziendali srl
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo import fields, models
5
+ from odoo.exceptions import UserError
6
+
7
+
8
+ class RibaDueDateSettlement(models.TransientModel):
9
+ _name = "riba.due.date.settlement"
10
+ _inherit = "riba.payment.multiple"
11
+ _description = "Riba Due Date Settlement"
12
+
13
+ due_date = fields.Date()
14
+
15
+ def due_date_settlement_confirm(self):
16
+ active_ids = self.env.context.get("active_ids", False)
17
+ if not active_ids:
18
+ raise UserError(self.env._("No active ID found."))
19
+ riba_lines = self.riba_line_ids.filtered(
20
+ lambda rl: rl.due_date == self.due_date
21
+ )
22
+ riba_lines.riba_line_settlement(
23
+ date=self.payment_date,
24
+ )