|
@ -58,7 +58,6 @@ class SubscriptionRequest(models.Model): |
|
|
@api.model |
|
|
@api.model |
|
|
def create(self, vals): |
|
|
def create(self, vals): |
|
|
partner_obj = self.env['res.partner'] |
|
|
partner_obj = self.env['res.partner'] |
|
|
mail_template_notif = self.get_mail_template_notif(False) |
|
|
|
|
|
|
|
|
|
|
|
if not vals.get('partner_id'): |
|
|
if not vals.get('partner_id'): |
|
|
cooperator = False |
|
|
cooperator = False |
|
@ -81,13 +80,13 @@ class SubscriptionRequest(models.Model): |
|
|
cooperator.write({'cooperator': True}) |
|
|
cooperator.write({'cooperator': True}) |
|
|
subscr_request = super(SubscriptionRequest, self).create(vals) |
|
|
subscr_request = super(SubscriptionRequest, self).create(vals) |
|
|
|
|
|
|
|
|
|
|
|
mail_template_notif = subscr_request.get_mail_template_notif(False) |
|
|
mail_template_notif.send_mail(subscr_request.id) |
|
|
mail_template_notif.send_mail(subscr_request.id) |
|
|
|
|
|
|
|
|
return subscr_request |
|
|
return subscr_request |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def create_comp_sub_req(self, vals): |
|
|
def create_comp_sub_req(self, vals): |
|
|
confirmation_mail_template = self.get_mail_template_notif(True) |
|
|
|
|
|
vals["name"] = vals['company_name'] |
|
|
vals["name"] = vals['company_name'] |
|
|
if not vals.get('partner_id'): |
|
|
if not vals.get('partner_id'): |
|
|
cooperator = self.env['res.partner'].get_cooperator_from_crn(vals.get('company_register_number')) |
|
|
cooperator = self.env['res.partner'].get_cooperator_from_crn(vals.get('company_register_number')) |
|
@ -97,6 +96,7 @@ class SubscriptionRequest(models.Model): |
|
|
vals['already_cooperator'] = True |
|
|
vals['already_cooperator'] = True |
|
|
subscr_request = super(SubscriptionRequest, self).create(vals) |
|
|
subscr_request = super(SubscriptionRequest, self).create(vals) |
|
|
|
|
|
|
|
|
|
|
|
confirmation_mail_template = subscr_request.get_mail_template_notif(True) |
|
|
confirmation_mail_template.send_mail(subscr_request.id) |
|
|
confirmation_mail_template.send_mail(subscr_request.id) |
|
|
|
|
|
|
|
|
return subscr_request |
|
|
return subscr_request |
|
@ -502,7 +502,7 @@ class SubscriptionRequest(models.Model): |
|
|
'out_inv_comm_algorithm': 'random', |
|
|
'out_inv_comm_algorithm': 'random', |
|
|
'lang': self.lang, |
|
|
'lang': self.lang, |
|
|
'birthdate_date': self.birthdate, |
|
|
'birthdate_date': self.birthdate, |
|
|
'parent_id': self.partner.id, |
|
|
|
|
|
|
|
|
'parent_id': self.partner_id.id, |
|
|
'representative': True, |
|
|
'representative': True, |
|
|
'function': self.contact_person_function, |
|
|
'function': self.contact_person_function, |
|
|
'type': 'representative', |
|
|
'type': 'representative', |
|
@ -553,11 +553,9 @@ class SubscriptionRequest(models.Model): |
|
|
if domain: |
|
|
if domain: |
|
|
partner = partner_obj.search(domain) |
|
|
partner = partner_obj.search(domain) |
|
|
|
|
|
|
|
|
if not partner.cooperator: |
|
|
|
|
|
partner.cooperator = True |
|
|
|
|
|
|
|
|
|
|
|
if not partner: |
|
|
if not partner: |
|
|
partner = self.create_coop_partner() |
|
|
partner = self.create_coop_partner() |
|
|
|
|
|
self.partner_id = partner |
|
|
else: |
|
|
else: |
|
|
partner = partner[0] |
|
|
partner = partner[0] |
|
|
|
|
|
|
|
@ -588,7 +586,7 @@ class SubscriptionRequest(models.Model): |
|
|
'representative': True}) |
|
|
'representative': True}) |
|
|
|
|
|
|
|
|
invoice = self.create_invoice(partner) |
|
|
invoice = self.create_invoice(partner) |
|
|
self.write({'partner_id': partner.id, 'state': 'done'}) |
|
|
|
|
|
|
|
|
self.write({'state': 'done'}) |
|
|
self.set_membership() |
|
|
self.set_membership() |
|
|
|
|
|
|
|
|
return invoice |
|
|
return invoice |
|
|