diff --git a/account_offbalance_sponsorship/README.rst b/account_offbalance_sponsorship/README.rst index 383464a8..dd6e490f 100644 --- a/account_offbalance_sponsorship/README.rst +++ b/account_offbalance_sponsorship/README.rst @@ -1,8 +1,8 @@ -================================== -Off balance sponsorship accounting -================================== +============================== +account_offbalance_sponsorship +============================== -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! @@ -17,18 +17,17 @@ Off balance sponsorship accounting :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-CompassionCH%2Ftest--repo-lightgray.png?logo=github - :target: https://github.com/CompassionCH/test-repo/tree/14.0/account_statement_completion + :target: https://github.com/CompassionCH/test-repo/tree/14.0/account_offbalance_sponsorship :alt: CompassionCH/test-repo |badge1| |badge2| |badge3| -This module adds a way to implement off-balance sponsorship accounting. -Sponsorship generate invoices to enable off balance accounting (which can be required in certain legislation) -we cannot rely on the odoo off-balance account feature (it does not allow a reconcilable account) -2 accounts are defined in the sponsorship config: Account asset and an reconcilable account. -This enable to have the full set of accounts from invoice generation to payment, all off the main chart of account. - -The income to be reported in the accounting is to be done in batch, once payments are in. +It's not possible to use the stock off-balance feature because it's not +possible to have a reconciliable off-balance account. So we use the 9xxx +account and a configuration to define: - receivable (off-balance): A - +asset (off-balance): B this function adds in the payment move if there +is an off-balance (A) receivable account: - the off-balance asset (B) - +add the outstanding account again. **Table of contents** @@ -41,7 +40,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -51,18 +50,12 @@ Credits Authors ------- -* Compassion CH - -Contributors ------------- - -- Steve Ferry -- Emanuel Cino -- Quentin Gigon +* Compassion Switzerland +* David Wulliamoz Maintainers ----------- -This module is part of the `CompassionCH/test-repo `_ project on GitHub. +This module is part of the `CompassionCH/test-repo `_ project on GitHub. You are welcome to contribute. diff --git a/account_offbalance_sponsorship/__init__.py b/account_offbalance_sponsorship/__init__.py index cde864ba..0650744f 100644 --- a/account_offbalance_sponsorship/__init__.py +++ b/account_offbalance_sponsorship/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/account_offbalance_sponsorship/__manifest__.py b/account_offbalance_sponsorship/__manifest__.py index 68362f2c..38dc8ce1 100644 --- a/account_offbalance_sponsorship/__manifest__.py +++ b/account_offbalance_sponsorship/__manifest__.py @@ -27,44 +27,24 @@ ############################################################################## { - 'name': "account_offbalance_sponsorship", - - 'summary': """ + "name": "account_offbalance_sponsorship", + "summary": """ Off-Balance accounting for sponsorships. """, - - 'description': """ - It's not possible to use the stock off-balance feature because - it's not possible to have a reconciliable off-balance account. So we use the 9xxx account and a configuration to - define: - - receivable (off-balance): A - - asset (off-balance): B - this function adds in the payment move if there is an off-balance (A) receivable account: - - the off-balance asset (B) - - add the outstanding account again. """, - - 'author': "Compassion CH", - 'website': "http://www.compassion.ch", - - # Categories can be used to filter modules in modules listing - # Check https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/ir_module_category_data.xml - # for the full list - 'category': 'sponsorship and donation', - 'version': '0.1', - + "author": "Compassion Switzerland, David Wulliamoz", + "website": "https://github.com/CompassionCH/test-repo", + "category": "sponsorship and donation", + "license": "AGPL-3", + "version": "14.0.1.0.0", # any module necessary for this one to work correctly - 'depends': ['base', - 'sponsorship_compassion', - #'account_reconcile_compassion', - ], - + "depends": [ + "base", + "sponsorship_compassion", + #'account_reconcile_compassion', + ], # always loaded - 'data': [ + "data": [ # 'security/ir.model.access.csv', - 'views/res_config_view.xml', - ], - # only loaded in demonstration mode - 'demo': [ - 'demo/demo.xml', + "views/res_config_view.xml", ], } diff --git a/account_offbalance_sponsorship/models/__init__.py b/account_offbalance_sponsorship/models/__init__.py index f7ca5d53..36471505 100644 --- a/account_offbalance_sponsorship/models/__init__.py +++ b/account_offbalance_sponsorship/models/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import account_move from . import res_config diff --git a/account_offbalance_sponsorship/models/account_move.py b/account_offbalance_sponsorship/models/account_move.py index fc1729d7..190d0d1b 100644 --- a/account_offbalance_sponsorship/models/account_move.py +++ b/account_offbalance_sponsorship/models/account_move.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-today Compassion CH (http://www.compassion.ch) @@ -9,99 +8,199 @@ # ############################################################################## -from odoo import _, models +from odoo import models + class AccountMove(models.Model): _inherit = "account.move" + def js_remove_outstanding_partial(self, partial_id): - ''' Called by the 'payment' widget to remove a reconciled entry to the present invoice. + """Called by the 'payment' widget to remove a reconciled entry to the present + invoice. - :param partial_id: The id of an existing partial reconciled with the current invoice. - ''' + :param partial_id: The id of an existing partial reconciled with the current + invoice. + """ mv = self.env["account.partial.reconcile"].browse(partial_id) - account_offbalance_receivable, account_offbalance_asset = self.line_ids.get_account_offbalance(mv.company_id) + ( + account_offbalance_receivable, + account_offbalance_asset, + ) = self.line_ids.get_account_offbalance(mv.company_id) pmt_move = mv.credit_move_id.move_id - rem_lines = self.env["account.move.line"].search([ - ("account_id", "=", account_offbalance_asset), ("move_id", "=", pmt_move.id), - ("debit", "=", mv.amount)]) + rem_lines = self.env["account.move.line"].search( + [ + ("account_id", "=", account_offbalance_asset), + ("move_id", "=", pmt_move.id), + ("debit", "=", mv.amount), + ] + ) if rem_lines.statement_line_id: rem_lines.statement_line_id.with_delay().button_undo_reconciliation() res = super().js_remove_outstanding_partial(partial_id) return res + class AccountMoveLine(models.Model): _inherit = "account.move.line" - def get_account_offbalance(self,company): + def get_account_offbalance(self, company): param_obj = self.env["res.config.settings"].with_company(company) - return (param_obj.get_param("account_offbalance_receivable"),param_obj.get_param("account_offbalance_asset")) + return ( + param_obj.get_param("account_offbalance_receivable"), + param_obj.get_param("account_offbalance_asset"), + ) def reconcile(self): res = super().reconcile() - account_offbalance_receivable,account_offbalance_asset = self.get_account_offbalance(self[0].move_id.company_id) + ( + account_offbalance_receivable, + account_offbalance_asset, + ) = self.get_account_offbalance(self[0].move_id.company_id) if self[0].account_id.id == account_offbalance_receivable: if "partials" in res.keys(): for part in res["partials"]: - self.add_off_balance_lines(part,account_offbalance_receivable,account_offbalance_asset,self[0].move_id.company_id) + self.add_off_balance_lines( + part, + account_offbalance_receivable, + account_offbalance_asset, + self[0].move_id.company_id, + ) return res - def add_off_balance_lines(self,mv,account_offbalance_receivable,account_offbalance_asset,company): + def add_off_balance_lines( + self, mv, account_offbalance_receivable, account_offbalance_asset, company + ): rec_invoice_line_ids = mv.debit_move_id.move_id.line_ids.filtered( - lambda l: l.account_id.code.startswith('93')) - counterpart_credit_amount = sum(inv_line.credit for inv_line in rec_invoice_line_ids) + lambda mvl: mvl.account_id.code.startswith("93") + ) + counterpart_credit_amount = sum( + inv_line.credit for inv_line in rec_invoice_line_ids + ) # Only allocate as income what has been "closed" pmt_move = mv.credit_move_id.move_id - pmt_move_receivable_amount = sum(l.credit - l.debit for l in pmt_move.line_ids.filtered(lambda a: a.account_id.id == account_offbalance_receivable)) - closed_amount = mv.amount if mv.amount + + + + +account_offbalance_sponsorship + + + +
+

account_offbalance_sponsorship

+ + +

Beta License: AGPL-3 CompassionCH/test-repo

+

It’s not possible to use the stock off-balance feature because it’s not +possible to have a reconciliable off-balance account. So we use the 9xxx +account and a configuration to define: - receivable (off-balance): A - +asset (off-balance): B this function adds in the payment move if there +is an off-balance (A) receivable account: - the off-balance asset (B) - +add the outstanding account again.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Compassion Switzerland
  • +
  • David Wulliamoz
  • +
+
+
+

Maintainers

+

This module is part of the CompassionCH/test-repo project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/account_offbalance_sponsorship/views/res_config_view.xml b/account_offbalance_sponsorship/views/res_config_view.xml index 840aba50..f77aa1fb 100644 --- a/account_offbalance_sponsorship/views/res_config_view.xml +++ b/account_offbalance_sponsorship/views/res_config_view.xml @@ -3,7 +3,10 @@ Offbalance accounting settings res.config.settings - +

Sponsorship off-balance accounting settings

@@ -11,12 +14,18 @@
-
-
diff --git a/account_statement_completion/i18n/fr_CH.po b/account_statement_completion/i18n/fr_CH.po index b8534d1d..384e5aa2 100644 --- a/account_statement_completion/i18n/fr_CH.po +++ b/account_statement_completion/i18n/fr_CH.po @@ -134,4 +134,4 @@ msgstr "Séquence" #. module: account_statement_completion #: model_terms:ir.ui.view,arch_db:account_statement_completion.statement_st_completion_rule_view_tree msgid "Statement Completion Rule" -msgstr "Règle de complétion de relevé" \ No newline at end of file +msgstr "Règle de complétion de relevé" diff --git a/recurring_contract/migrations/14.0.1.0.2/post-migration.py b/recurring_contract/migrations/14.0.1.0.2/post-migration.py index e459860f..057ff272 100644 --- a/recurring_contract/migrations/14.0.1.0.2/post-migration.py +++ b/recurring_contract/migrations/14.0.1.0.2/post-migration.py @@ -17,10 +17,12 @@ def migrate(cr, version): having count(*) = 1) """ ) - cr.execute(""" + cr.execute( + """ ALTER TABLE account_move_recurring_contract_rel DROP COLUMN account_invoice_id; - """) + """ + ) cr.execute( """INSERT INTO account_move_recurring_contract_rel (recurring_contract_id, account_move_id) diff --git a/setup/account_offbalance_sponsorship/odoo/addons/account_offbalance_sponsorship b/setup/account_offbalance_sponsorship/odoo/addons/account_offbalance_sponsorship new file mode 120000 index 00000000..4e7f7029 --- /dev/null +++ b/setup/account_offbalance_sponsorship/odoo/addons/account_offbalance_sponsorship @@ -0,0 +1 @@ +../../../../account_offbalance_sponsorship \ No newline at end of file diff --git a/setup/account_offbalance_sponsorship/setup.py b/setup/account_offbalance_sponsorship/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_offbalance_sponsorship/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)