forked from Yaltik/golem
[ADD]GOLEM Activity Registration Payment : handle openings
* Open invoices, including those linked to minors ; * Open payments, including those linked to minors.
This commit is contained in:
parent
3c4ba1beae
commit
17ddecbbfb
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2018-2019 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
|
||||
@ -15,4 +15,4 @@
|
||||
# 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 wizard
|
||||
from . import wizard, models
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2018-2019 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
|
||||
@ -18,13 +18,14 @@
|
||||
{
|
||||
'name': 'GOLEM Activity Payment for Minors',
|
||||
'summary': 'GOLEM Activity Registration Payment for Minors',
|
||||
'version': '10.0.0.1.1',
|
||||
'version': '10.0.0.2.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'depends': ['golem_member_minor', 'golem_activity_registration_payment'],
|
||||
'depends': ['golem_member_minor', 'golem_activity_registration_payment',
|
||||
'golem_member_account'],
|
||||
'data': ['views/golem_activity_registration_invoicing.xml']
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2019 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_member
|
@ -0,0 +1,61 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2019 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 Member adaptations """
|
||||
|
||||
from odoo import models, api
|
||||
|
||||
|
||||
class GolemMember(models.Model):
|
||||
""" GOLEM Member adaptations """
|
||||
_inherit = 'golem.member'
|
||||
|
||||
@api.multi
|
||||
def open_partner_invoices(self):
|
||||
""" Overwrite open member invoices """
|
||||
self.ensure_one()
|
||||
domain = ['|',
|
||||
('partner_id', '=', self.partner_id.id),
|
||||
('partner_ids', '=', self.partner_id.id)]
|
||||
invoice_ids = self.env['account.invoice'].search(domain)
|
||||
action = self.env.ref('account.action_invoice_tree1').read()[0]
|
||||
action['context'] = {'type':'out_invoice', 'journal_type': 'sale',
|
||||
'default_partner_id': self[0].partner_id.id}
|
||||
action['domain'] = [('id', 'in', invoice_ids.ids)]
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
def open_partner_payments(self):
|
||||
""" Overwrite open member payments """
|
||||
self.ensure_one()
|
||||
# Get related invoices
|
||||
domain = ['|',
|
||||
('partner_id', '=', self.partner_id.id),
|
||||
('partner_ids', '=', self.partner_id.id)]
|
||||
invoice_ids = self.env['account.invoice'].search(domain)
|
||||
# Get related payments
|
||||
domain = ['|',
|
||||
('partner_id', '=', self.partner_id.id),
|
||||
('invoice_ids', 'in', invoice_ids.ids)]
|
||||
payment_ids = self.env['account.payment'].search(domain)
|
||||
|
||||
action = self.env.ref('account.action_account_payments').read()[0]
|
||||
action['context'] = {'default_payment_type': 'inbound',
|
||||
'default_partner_type': 'customer',
|
||||
'default_partner_id': self[0].partner_id.id}
|
||||
action['domain'] = [('id', 'in', payment_ids.ids)]
|
||||
return action
|
Loading…
Reference in New Issue
Block a user