diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 6bef656..4cb27bb 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -320,6 +320,7 @@ class subscription_request(models.Model): contact = False if self.no_registre: contact = partner_obj.search([('national_register_number','=',self.no_registre)]) + contact.type = 'representative' if not contact: contact_vals = {'name':self.name, 'first_name':self.firstname, 'last_name': self.lastname, 'customer':False, 'is_company':False, 'cooperator':True, @@ -328,7 +329,7 @@ class subscription_request(models.Model): 'national_register_number':self.no_registre, 'out_inv_comm_type':'bba', 'out_inv_comm_algorithm':'random', 'country_id': self.country_id.id, 'lang':self.lang, 'birthdate_date':self.birthdate, 'parent_id': partner.id, - 'function':self.contact_person_function,'representative':True} + 'function':self.contact_person_function,'representative':True,'type':'representative'} contact = partner_obj.create(contact_vals) else: if len(contact) > 1: @@ -336,7 +337,7 @@ class subscription_request(models.Model): if contact.parent_id and contact.parent_id.id != partner.id: raise UserError(_('This contact person is already defined for another company. Please select another contact')) else: - contact.parent_id = partner.id + contact.write({'parent_id':partner.id,'representative':True}) invoice = self.create_invoice(partner) self.write({'partner_id':partner.id, 'state':'done'}) diff --git a/easy_my_coop/security/ir.model.access.csv b/easy_my_coop/security/ir.model.access.csv index 9482133..f4e04f7 100644 --- a/easy_my_coop/security/ir.model.access.csv +++ b/easy_my_coop/security/ir.model.access.csv @@ -11,4 +11,9 @@ access_share_line_super_manager,share.line,model_share_line,group_energiris_supe access_subscription_register_super_manager,subscription_register,model_subscription_register,group_energiris_super_manager,1,1,1,1 access_subscription_request_super_manager,subscription.request,model_subscription_request,group_energiris_super_manager,1,1,1,1 access_operation_request,operation.request,model_operation_request,group_energiris_manager,1,1,1,0 -access_operation_request_super_manager,operation.request,model_operation_request,group_energiris_super_manager,1,1,1,1 \ No newline at end of file +access_operation_request_super_manager,operation.request,model_operation_request,group_energiris_super_manager,1,1,1,1 +access_product_product_user,product.product,product.model_product_product,group_energiris_user,1,1,1,0 +access_product_product_manager,product.product,product.model_product_product,group_energiris_manager,1,1,1,1 +access_product_template_user,product.template,product.model_product_template,group_energiris_user,1,1,1,0 +access_product_template_manager,product.template,product.model_product_template,group_energiris_manager,1,1,1,1 +"",,,,,,,