diff --git a/golem_payment/__init__.py b/golem_payment/__init__.py new file mode 100644 index 0000000..82314be --- /dev/null +++ b/golem_payment/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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 . + +from . import models diff --git a/golem_payment/__manifest__.py b/golem_payment/__manifest__.py new file mode 100644 index 0000000..a5087d5 --- /dev/null +++ b/golem_payment/__manifest__.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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 . + +{ + 'name': 'GOLEM payment', + 'summary': 'Usage of account invoice and account payments', + 'description': ''' Ability to create invoice(s) from activity subscriptions + and anticipate multiple payments. Uses GOLEM Activity Registration State. ''', + 'version': '10.0.0.1.0', + 'category': 'GOLEM', + 'author': 'Fabien Bourgeois', + 'license': 'AGPL-3', + 'application': True, + 'installable': True, + 'depends': ['account', 'golem_season'], + 'data': ['views/golem_payment_views.xml'] +} diff --git a/golem_payment/models/__init__.py b/golem_payment/models/__init__.py new file mode 100644 index 0000000..0fdbb27 --- /dev/null +++ b/golem_payment/models/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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 . + +from . import golem_payment diff --git a/golem_payment/models/golem_payment.py b/golem_payment/models/golem_payment.py new file mode 100644 index 0000000..36d5521 --- /dev/null +++ b/golem_payment/models/golem_payment.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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 . + +""" GOLEM Payment models """ + +from odoo import models, fields, api, _ + +class GolemPaymentScheduleDay(models.Model): + """ Schedule day simple model """ + _name = 'golem.payment.schedule.day' + _rec_name = 'day' + _sql_constraints = [('golem_payment_schedule_day_uniq', 'UNIQUE (day)', + _('Day must be unique.'))] + + day = fields.Date(required=True, index=True) + + +class GolemPaymentSchedule(models.Model): + """ GOLEM Payment Schedule """ + _name = 'golem.payment.schedule' + _description = 'GOLEM Payment Schedule' + _order = 'season_id desc' + + name = fields.Char(required=True) + season_id = fields.Many2one('golem.season', 'Season', required=True) + day_ids = fields.Many2many('golem.payment.schedule.day', string='Days') + occurences = fields.Integer(compute='_compute_occurences') + + @api.depends('day_ids') + def _compute_occurences(self): + """ Computes number of occurences """ + for schedule in self: + schedule.occurences = len(self.day_ids) diff --git a/golem_payment/views/golem_payment_views.xml b/golem_payment/views/golem_payment_views.xml new file mode 100644 index 0000000..def9e2d --- /dev/null +++ b/golem_payment/views/golem_payment_views.xml @@ -0,0 +1,61 @@ + + + + + + + + + + GOLEM Payment Schedule Tree + golem.payment.schedule + + + + + + + + + + + + + GOLEM Payment Schedule Filters + golem.payment.schedule + + + + + + + + + + + + + + + + + +