From ad0d5b0ff6ae88db3ab3eb774aa8ae65aeaef00f Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Tue, 17 Jul 2018 17:48:15 +0200 Subject: [PATCH] [ADD]GOLEM Membership : accounting data * Default memebrship accounts ; * New journals : check, credit card. --- golem_membership/__manifest__.py | 7 +-- golem_membership/data/account_data.xml | 42 +++++++++++++++++ golem_membership/i18n/fr.po | 28 +++++++++-- golem_membership/i18n/golem_membership.pot | 24 +++++++++- golem_membership/models/__init__.py | 4 +- golem_membership/models/account_config.py | 55 ++++++++++++++++++++++ 6 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 golem_membership/data/account_data.xml create mode 100644 golem_membership/models/account_config.py diff --git a/golem_membership/__manifest__.py b/golem_membership/__manifest__.py index cd07e0d..a2ecf85 100644 --- a/golem_membership/__manifest__.py +++ b/golem_membership/__manifest__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Fabien Bourgeois +# Copyright 2016-2018 Fabien Bourgeois # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -18,14 +18,15 @@ { 'name': 'GOLEM non-profit membership handling', 'summary': 'Extends Odoo membership', - 'version': '10.0.1.1.3', + 'version': '10.0.1.1.4', 'category': 'GOLEM', 'author': 'Fabien Bourgeois, Michel Dessenne', 'license': 'AGPL-3', 'application': False, 'installable': True, 'depends': ['golem_member', 'account', 'decimal_precision'], - 'data': ['views/golem_membership_invoice.xml', + 'data': ['data/account_data.xml', + 'views/golem_membership_invoice.xml', 'views/golem_member_view.xml', 'report/golem_member_card_templates.xml'] } diff --git a/golem_membership/data/account_data.xml b/golem_membership/data/account_data.xml new file mode 100644 index 0000000..412b62c --- /dev/null +++ b/golem_membership/data/account_data.xml @@ -0,0 +1,42 @@ + + + + + + + + + + 756 + Cotisations des membres + + + + + + 756200 + Adhésions + + + + + + + + + diff --git a/golem_membership/i18n/fr.po b/golem_membership/i18n/fr.po index 812373b..50130e0 100644 --- a/golem_membership/i18n/fr.po +++ b/golem_membership/i18n/fr.po @@ -6,15 +6,14 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-08 15:10+0000\n" -"PO-Revision-Date: 2018-03-08 15:10+0000\n" +"POT-Creation-Date: 2018-07-17 15:27+0000\n" +"PO-Revision-Date: 2018-07-17 17:47+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Plural-Forms: \n" #. module: golem_membership #: model:ir.ui.view,arch_db:golem_membership.golem_member_form_inherit_golem_membership @@ -26,6 +25,12 @@ msgstr "Payer une cotisation" msgid "Cancel" msgstr "Annuler" +#. module: golem_membership +#: code:addons/golem_membership/models/account_config.py:43 +#, python-format +msgid "Check" +msgstr "Chèque" + #. module: golem_membership #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_uid msgid "Created by" @@ -36,6 +41,12 @@ msgstr "Créé par" msgid "Created on" msgstr "Créé le" +#. module: golem_membership +#: code:addons/golem_membership/models/account_config.py:48 +#, python-format +msgid "Credit Card" +msgstr "Carte bancaire" + #. module: golem_membership #: model:ir.ui.view,arch_db:golem_membership.golem_member_card_template_inherit_golem_membership msgid "Date from" @@ -47,6 +58,7 @@ msgid "Date to" msgstr "Fin" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config_display_name #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_display_name msgid "Display Name" msgstr "Nom affiché" @@ -56,12 +68,18 @@ msgstr "Nom affiché" msgid "GOLEM MemberShip invoicing" msgstr "GOLEM : facturation de l'adhésion" +#. module: golem_membership +#: model:ir.model,name:golem_membership.model_golem_membership_account_config +msgid "GOLEM Membership Account Configuration" +msgstr "GOLEM Membership Account Configuration" + #. module: golem_membership #: model:ir.ui.view,arch_db:golem_membership.golem_member_search_inherit_golem_membership msgid "Has contributed" msgstr "A cotisé" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config_id #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id msgid "ID" msgstr "ID" @@ -82,6 +100,7 @@ msgid "Join Membership" msgstr "Adhésion" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config___last_update #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice___last_update msgid "Last Modified on" msgstr "Dernière Modification le" @@ -142,3 +161,4 @@ msgstr "État" #: model:ir.ui.view,arch_db:golem_membership.golem_membership_invoice_form msgid "or" msgstr "ou" + diff --git a/golem_membership/i18n/golem_membership.pot b/golem_membership/i18n/golem_membership.pot index ab63c3d..e02d5ed 100644 --- a/golem_membership/i18n/golem_membership.pot +++ b/golem_membership/i18n/golem_membership.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-08 15:09+0000\n" -"PO-Revision-Date: 2018-03-08 15:09+0000\n" +"POT-Creation-Date: 2018-07-17 15:27+0000\n" +"PO-Revision-Date: 2018-07-17 15:27+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -25,6 +25,12 @@ msgstr "" msgid "Cancel" msgstr "" +#. module: golem_membership +#: code:addons/golem_membership/models/account_config.py:43 +#, python-format +msgid "Check" +msgstr "" + #. module: golem_membership #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_create_uid msgid "Created by" @@ -35,6 +41,12 @@ msgstr "" msgid "Created on" msgstr "" +#. module: golem_membership +#: code:addons/golem_membership/models/account_config.py:48 +#, python-format +msgid "Credit Card" +msgstr "" + #. module: golem_membership #: model:ir.ui.view,arch_db:golem_membership.golem_member_card_template_inherit_golem_membership msgid "Date from" @@ -46,6 +58,7 @@ msgid "Date to" msgstr "" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config_display_name #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_display_name msgid "Display Name" msgstr "" @@ -55,12 +68,18 @@ msgstr "" msgid "GOLEM MemberShip invoicing" msgstr "" +#. module: golem_membership +#: model:ir.model,name:golem_membership.model_golem_membership_account_config +msgid "GOLEM Membership Account Configuration" +msgstr "" + #. module: golem_membership #: model:ir.ui.view,arch_db:golem_membership.golem_member_search_inherit_golem_membership msgid "Has contributed" msgstr "" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config_id #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice_id msgid "ID" msgstr "" @@ -81,6 +100,7 @@ msgid "Join Membership" msgstr "" #. module: golem_membership +#: model:ir.model.fields,field_description:golem_membership.field_golem_membership_account_config___last_update #: model:ir.model.fields,field_description:golem_membership.field_golem_membership_invoice___last_update msgid "Last Modified on" msgstr "" diff --git a/golem_membership/models/__init__.py b/golem_membership/models/__init__.py index 01edfaf..6064e84 100644 --- a/golem_membership/models/__init__.py +++ b/golem_membership/models/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Fabien Bourgeois +# Copyright 2016-2018 Fabien Bourgeois # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -15,4 +15,4 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from . import golem_membership +from . import golem_membership, account_config diff --git a/golem_membership/models/account_config.py b/golem_membership/models/account_config.py new file mode 100644 index 0000000..a3c942c --- /dev/null +++ b/golem_membership/models/account_config.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +""" Base Account membership configuration for GOLEM """ + +from odoo import models, api, _ + + +class AccountConfig(models.AbstractModel): + """ GOLEM Membership Account Configuration """ + _name = 'golem.membership.account.config' + _description = 'GOLEM Membership Account Configuration' + + @api.model + def account_settings(self): + """ Please use better default taxes and account.journal config """ + account_conf_obj = self.env['account.config.settings'] + data = {'company_id': self.env.ref('base.main_company').id} + account_conf = account_conf_obj.create(data) + account_conf.update({ + 'default_sale_tax_id': self.env.ref('l10n_fr.tva_0').id, + 'default_purchase_tax_id': self.env.ref('l10n_fr.tva_acq_normale').id + }) + account_conf.execute() + + journal_obj = self.env['account.journal'] + bank_journal = journal_obj.search([('type', '=', 'bank')], limit=1) + chk_journal = journal_obj.search([('code', '=', 'CHK')]) + if not chk_journal: + journal_obj.create({ + 'name': _('Check'), 'code': 'CHK', 'type': 'bank', + 'default_debit_account_id': bank_journal.default_debit_account_id.id, + 'default_credit_account_id': bank_journal.default_credit_account_id.id + }) + ccard_journal = journal_obj.search([('code', '=', 'CCARD')]) + if not ccard_journal: + journal_obj.create({ + 'name': _('Credit Card'), 'code': 'CCARD', 'type': 'bank', + 'default_debit_account_id': bank_journal.default_debit_account_id.id, + 'default_credit_account_id': bank_journal.default_credit_account_id.id + })