[FIX]GOLEM Activity Registration Payment Member Minor : handle payment

On the name of on payments too
This commit is contained in:
Fabien BOURGEOIS 2018-11-01 19:50:02 +01:00
parent 1c156fe667
commit 78238bd562
2 changed files with 10 additions and 2 deletions

View File

@ -18,7 +18,7 @@
{
'name': 'GOLEM Activity Payment for Minors',
'summary': 'GOLEM Activity Registration Payment for Minors',
'version': '10.0.0.1.0',
'version': '10.0.0.1.1',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -43,12 +43,20 @@ class GolemActivityRegistrationInvoicing(models.TransientModel):
self.ensure_one()
invoice = super(GolemActivityRegistrationInvoicing, self)._create_invoice()
if self[0].is_minor:
invoice.write({'': self[0].on_the_name_of.id,
invoice.write({'partner_id': self[0].on_the_name_of.id,
'is_minor_invoice': True,
'partner_ids': [(6, 0, [self[0].on_the_name_of.id,
self[0].member_id.partner_id.id])]})
return invoice
def _create_payments(self, invoice):
""" Create payment if schedule has been chosen : handling minor case """
self.ensure_one()
payments = super(GolemActivityRegistrationInvoicing, self)._create_payments(invoice)
if self.on_the_name_of:
payments.write({'partner_id': self.on_the_name_of.id})
return payments
@api.multi
def validate(self):
""" Validate and create invoice and payments """