[ADD]GOLEM Payment, now just with payment schedules

This commit is contained in:
Fabien Bourgeois 2017-06-14 23:48:18 +02:00
parent 97d7702e2d
commit b51dbb2df7
5 changed files with 175 additions and 0 deletions

18
golem_payment/__init__.py Normal file
View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
#
# 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 <http://www.gnu.org/licenses/>.
from . import models

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
#
# 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 <http://www.gnu.org/licenses/>.
{
'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']
}

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
#
# 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 <http://www.gnu.org/licenses/>.
from . import golem_payment

View File

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
#
# 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 <http://www.gnu.org/licenses/>.
""" 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)

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
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 <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Trees -->
<record id="golem_payment_schedule_tree" model="ir.ui.view">
<field name="name">GOLEM Payment Schedule Tree</field>
<field name="model">golem.payment.schedule</field>
<field name="arch" type="xml">
<tree editable="top">
<field name="name" />
<field name="season_id" />
<field name="day_ids" widget="many2many_tags" />
<field name="occurences" />
</tree>
</field>
</record>
<!-- Search -->
<record id="golem_payment_schedule_search" model="ir.ui.view">
<field name="name">GOLEM Payment Schedule Filters</field>
<field name="model">golem.payment.schedule</field>
<field name="arch" type="xml">
<search>
<field name="name" />
<field name="season_id" />
</search>
</field>
</record>
<!-- Actions -->
<act_window id="golem_payment_schedule_action" name="Payment Schedules"
res_model="golem.payment.schedule" view_mode="tree" />
<!-- Menus -->
<menuitem id="golem_payment_schedule_menu_list" sequence="5"
parent="payment.root_payment_menu" action="golem_payment_schedule_action"
groups="golem_base.group_golem_manager" />
</data>
</odoo>