diff --git a/__manifest__.py b/__manifest__.py index 30d591ceb33a06c8f7b76124a80d09df8fccdb3e..fef71de54a7dcfe0fd84d4adff055e11551c466d 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -26,6 +26,8 @@ "views/scop_config_views.xml", "views/scop_config_lists_views.xml", "datas/res.country.csv", + "datas/union.regionale.csv", + "datas/res.partner.category.csv", "datas/res.partner.certification.csv", "datas/res.partner.company.type.csv", "datas/res.partner.cooperative.form.csv", @@ -40,6 +42,5 @@ "datas/scop.legal.event.type.csv", "datas/scop.membership.reason.end.csv", "datas/scop.membership.type.csv", - "datas/union.regionale.csv", ] } diff --git a/datas/res.partner.category.csv b/datas/res.partner.category.csv new file mode 100644 index 0000000000000000000000000000000000000000..e00d82460c55e5730cb5a3d93143984c6d649c47 --- /dev/null +++ b/datas/res.partner.category.csv @@ -0,0 +1,26 @@ +"id","ur_id","id_riga","name" +aura_01,"AURA","11776","Alimentation / Agriculture / Horticulture" +aura_02,"AURA","14074","Bois / Ameublement / carton / Verre / Céramique" +aura_03,"AURA","11777","BTP et activités connexes" +aura_04,"AURA","14075","Bureaux d'etudes batiment" +aura_05,"AURA","14076","Cuirs et étoffes" +aura_06,"AURA","14077","Divers" +aura_07,"AURA","14078","Fonderie / Travail des métaux / Mécanique" +aura_08,"AURA","14079","Industrie du livre et communication" +aura_09,"AURA","14080","Services intellectuels et culturels" +aura_10,"AURA","14081","Services matériels" +idf_01,"Paris","14071","ACTION SOCIALE" +idf_02,"Paris","14073","ALIMENTATION / COMMERCE" +idf_03,"Paris","11772","ARTISANAT / PETITE PRODUCTION" +idf_04,"Paris","14063","BTP" +idf_05,"Paris","14068","COMMUNICATION / WEB / PRESSE / EVT" +idf_06,"Paris","14069","CULTURE / LOISIR" +idf_07,"Paris","14072","EDITION" +idf_08,"Paris","14064","ETUDES ET CONCEPTION BTP / AMENAGEMENT TERRITOIRE " +idf_09,"Paris","14070","FORMATION / ACCOMPAGNEMENT DES PERSONNES" +idf_10,"Paris","14065","FORMATION / CONSEIL AUX ORGANISATIONS" +idf_11,"Paris","14062","IMPRIMERIE / REPROGRAPHIE / FACONNAGE / ROUTAGE" +idf_12,"Paris","11771","INDUSTRIE" +idf_13,"Paris","14067","INFORMATIQUE (développement, conseil, maintenance)" +idf_14,"Paris","14066","PRESTATION DE SERVICE" +idf_15,"Paris","11773","TRANSPORT / MANUTENTION" \ No newline at end of file diff --git a/datas/res.partner.certification.csv b/datas/res.partner.certification.csv index 60c3822c3d55d92c6b32cf6a827b639babe2ab12..689aeb714720829676a0dbe3cf69b54ca42f4408 100644 --- a/datas/res.partner.certification.csv +++ b/datas/res.partner.certification.csv @@ -1,17 +1,17 @@ id,id_riga,name -"riga_16747",16747,"Aéronautique EN9100" -"riga_14102",14102,"Autres (à preciser)" -"riga_13038",13038,"Centre de formation" -"riga_11571",11571,"Entreprise adaptée" -"riga_11570",11570,"Entreprise d'insertion" -"riga_11573",11573,"Entreprise Solidaire" -"riga_16429",16429,"ESUS" -"riga_11576",11576,"ISO 14 001" -"riga_16538",16538,"ISO 26 000" -"riga_11575",11575,"ISO 9 001" -"riga_11574",11574,"Jeune Entreprise Innovante" -"riga_13037",13037,"Lamaneur" -"riga_16774",16774,"QHSAS 18001" -"riga_16775",16775,"QUALIPAYSAGE" -"riga_14126",14126,"SAP" -"riga_11572",11572,"Services à la personne" +riga_16747,16747,"Aéronautique EN9100" +riga_14102,14102,"Autres (à preciser)" +riga_13038,13038,"Centre de formation" +riga_11571,11571,"Entreprise adaptée" +riga_11570,11570,"Entreprise d'insertion" +riga_11573,11573,"Entreprise Solidaire" +riga_16429,16429,"ESUS" +riga_11576,11576,"ISO 14 001" +riga_16538,16538,"ISO 26 000" +riga_11575,11575,"ISO 9 001" +riga_11574,11574,"Jeune Entreprise Innovante" +riga_13037,13037,"Lamaneur" +riga_16774,16774,"QHSAS 18001" +riga_16775,16775,"QUALIPAYSAGE" +riga_14126,14126,"SAP" +riga_11572,11572,"Services à la personne" diff --git a/datas/res.partner.company.type.csv b/datas/res.partner.company.type.csv index 0ab47d3334ccf06cc7f5fff96e4fd5ea46256bd4..7cffbc356cbf1d4b3876f5c9db3de5d05731ef11 100644 --- a/datas/res.partner.company.type.csv +++ b/datas/res.partner.company.type.csv @@ -1,14 +1,14 @@ id,name,id_riga,shortcut -"riga_14675","Artisan / Commerçant",14675,"" -"riga_14672","Association loi 1901 ou assimilée",14672,"asso" -"riga_14673","Collectivité territoriale",14673,"" -"riga_14674","Profession libérale",14674,"" -"riga_14669","Société à Responsabilité Limitée (SARL)",14669,"SARL" -"riga_16496","Société à Responsabilité Limitée (SARL) unipersonnelle",16496,"SARLU" -"riga_14668","Société Anonyme à Conseil d'Administration",14668,"SA" -"riga_14670","Société Anonyme à directoire",14670,"SA" -"riga_14677","Société civile coopérative",14677,"" -"riga_14860","Société Civile Immobilière (SCI)",14860,"SCI" -"riga_16771","Société d exercice libéral par action simplifiée (SELAS)",16771,"SELAS" -"riga_14671","Société par actions simplifiée (SAS)",14671,"SAS" -"riga_16399","Société par actions simplifiée à associé unique (SASU)",16399,"SAS" +riga_14675,"Artisan / Commerçant",14675,"" +riga_14672,"Association loi 1901 ou assimilée",14672,"asso" +riga_14673,"Collectivité territoriale",14673,"" +riga_14674,"Profession libérale",14674,"" +riga_14669,"Société à Responsabilité Limitée (SARL)",14669,"SARL" +riga_16496,"Société à Responsabilité Limitée (SARL) unipersonnelle",16496,"SARLU" +riga_14668,"Société Anonyme à Conseil d'Administration",14668,"SA" +riga_14670,"Société Anonyme à directoire",14670,"SA" +riga_14677,"Société civile coopérative",14677,"" +riga_14860,"Société Civile Immobilière (SCI)",14860,"SCI" +riga_16771,"Société d exercice libéral par action simplifiée (SELAS)",16771,"SELAS" +riga_14671,"Société par actions simplifiée (SAS)",14671,"SAS" +riga_16399,"Société par actions simplifiée à associé unique (SASU)",16399,"SAS" diff --git a/datas/res.partner.creation.origin.csv b/datas/res.partner.creation.origin.csv index e73d544e00e5099e3e076e8c67c9b372dfd5cb8b..979817375cabaa206ea723c28ad4c29e231b1772 100644 --- a/datas/res.partner.creation.origin.csv +++ b/datas/res.partner.creation.origin.csv @@ -1,17 +1,17 @@ "id","parent_id:id","name","id_riga" -"riga_14215",,"Ex-Nihilo",14215 -15,"riga_14215","Création par des porteurs de projet",14648 -16,"riga_14215","Création d'une filiale de Scop ou de Scic",14649 -17,"riga_14215","Essaimage",14658 -"riga_14634",,"Transmission d'entreprise saine",14634 -21,"riga_14634","Transmission d'une entreprise indépendante saine avec départ des dirigeants (succession)",14993 -22,"riga_14634","Transmission d'une entreprise indépendante saine avec maintien des dirigeants",14992 -26,"riga_14634","Transmission d'une filiale suite à restructuration de groupe",14661 -27,"riga_14634","Transmission d'une filiale d'une association",14660 -"riga_14217",,"Reprise d'entreprise en difficulté",14217 -35,"riga_14217","Reprise d'une entreprise en procédure collective",14656 -36,"riga_14217","Reprise d'une entreprise en difficulté économique",14652 -37,"riga_14217","Création suite à un arrêt d'activité",14655 -"riga_14218",,"Transformation d'association ou de coopérative",14218 -45,"riga_14218","Transformation d'une association (hors association de préfiguration)",14659 -46,"riga_14218","Transformation d'une Coopérative",14653 +exnihilo,,"Ex-Nihilo",14215 +exnihilo_5,exnihilo,"Création par des porteurs de projet",14648 +exnihilo_6,exnihilo,"Création d'une filiale de Scop ou de Scic",14649 +exnihilo_7,exnihilo,"Essaimage",14658 +transmission,,"Transmission d'entreprise saine",14634 +transmission_1,transmission,"Transmission d'une entreprise indépendante saine avec départ des dirigeants (succession)",14993 +transmission_2,transmission,"Transmission d'une entreprise indépendante saine avec maintien des dirigeants",14992 +transmission_6,transmission,"Transmission d'une filiale suite à restructuration de groupe",14661 +transmission_7,transmission,"Transmission d'une filiale d'une association",14660 +reprise,,"Reprise d'entreprise en difficulté",14217 +reprise_5,reprise,"Reprise d'une entreprise en procédure collective",14656 +reprise_6,reprise,"Reprise d'une entreprise en difficulté économique",14652 +reprise_7,reprise,"Création suite à un arrêt d'activité",14655 +transformation,,"Transformation d'association ou de coopérative",14218 +transformation_5,transformation,"Transformation d'une association (hors association de préfiguration)",14659 +transformation_6,transformation,"Transformation d'une Coopérative",14653 diff --git a/datas/union.regionale.csv b/datas/union.regionale.csv index 6c518f5aaf24d830c16533982bb6815edc49c7dc..f28b052539544297f17867e7029cd8031e9233d1 100644 --- a/datas/union.regionale.csv +++ b/datas/union.regionale.csv @@ -1,13 +1,13 @@ id,id_riga,long_name,name -"ur_idf","12784","UNION REGIONALE DES SCOP ILE DE FRANCE CENTRE VAL DE LOIRE DOM-TOM","Paris" -"ur_hdf","12785","UNION REGIONALE DES SCOP HAUTS DE FRANCE","Hauts-de-France" -"ur_bfc","12787","UNION REGIONALE DES SCOP BOURGOGNE FRANCHE COMTE","Bourgogne" -"ur_ge","12788","UNION REGIONALE DES SCOP GRAND EST","Est" -"ur_arh","12789","UNION REGIONALE DES SCOP AUVERGNE RHONE ALPES","AURA" -"ur_pacac","12791","UNION REGIONALE DES SCOP PROVENCE ALPES COTE D'AZUR CORSE","Paca" -"ur_mp","12792","UNION REGIONALE DES SCOP MIDI PYRENEES","Midi Pyrénées" -"ur_lim","12793","UNION REGIONALE DES SCOP LIMOUSIN","Limousin Berry" -"ur_pc","12794","UNION REGIONALE DES SCOP POITOU CHARENTES","Poitou Charentes" -"ur_go","12795","UNION REGIONALE DES SCOP OUEST","Ouest" -"ur_aq","12796","UNION REGIONALE DES SCOP AQUITAINE","Aquitaine" -"ur_lr","12797","UNION REGIONALE DES SCOP LANGUEDOC ROUSSILLON","Languedoc Roussillon" +ur_idf,"12784","UNION REGIONALE DES SCOP ILE DE FRANCE CENTRE VAL DE LOIRE DOM-TOM","Paris" +ur_hdf,"12785","UNION REGIONALE DES SCOP HAUTS DE FRANCE","Hauts-de-France" +ur_bfc,"12787","UNION REGIONALE DES SCOP BOURGOGNE FRANCHE COMTE","Bourgogne" +ur_ge,"12788","UNION REGIONALE DES SCOP GRAND EST","Est" +ur_arh,"12789","UNION REGIONALE DES SCOP AUVERGNE RHONE ALPES","AURA" +ur_pacac,"12791","UNION REGIONALE DES SCOP PROVENCE ALPES COTE D'AZUR CORSE","Paca" +ur_mp,"12792","UNION REGIONALE DES SCOP MIDI PYRENEES","Midi Pyrénées" +ur_lim,"12793","UNION REGIONALE DES SCOP LIMOUSIN","Limousin Berry" +ur_pc,"12794","UNION REGIONALE DES SCOP POITOU CHARENTES","Poitou Charentes" +ur_go,"12795","UNION REGIONALE DES SCOP OUEST","Ouest" +ur_aq,"12796","UNION REGIONALE DES SCOP AQUITAINE","Aquitaine" +ur_lr,"12797","UNION REGIONALE DES SCOP LANGUEDOC ROUSSILLON","Languedoc Roussillon" diff --git a/models/res_company.py b/models/res_company.py index 098fdce9681a6f9a71364c74222c784fac42a204..51bdb86e16bf03e50e4364c67148b7bd148f6385 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -12,5 +12,4 @@ class ResCompany(models.Model): # Renvoie l'UR de l'utlisateur courant return self.env['res.users']._get_ur() - ur_id = fields.Many2one('union.regionale', string='UR', - default="_ur_default_get") + ur_id = fields.Many2one('union.regionale', string='UR') diff --git a/models/res_partner.py b/models/res_partner.py index 8e66bbe9c02320eff6cdba5463d795d6a61028b5..856a372300620e07a78c760ad5faf798eebf94fa 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -388,8 +388,7 @@ class ScopPartner(models.Model): @api.multi def coop_open_act(self): - user_current = self.env.user.id - company_current = self.env['res.company'].browse(self.env.user.company_id.id) + ur_current = self.env.user.company_id.ur_id return { 'name': _("Cooperative"), 'type': 'ir.actions.act_window', @@ -398,13 +397,34 @@ class ScopPartner(models.Model): 'view_type': 'form', 'views': [[False, 'tree'], [False, 'form'], ], # 'context': {'search_default_company_id': [company_current.id]}, - 'context': {'search_default_type_cooperative': True, 'search_default_company_id': [company_current.id], 'default_is_company': True, 'default_is_cooperative': True, 'default_company_type': 'company', 'default_project_status': '5_suivi'}, + 'context': {'search_default_type_cooperative': True, + 'search_default_ur_id': [ur_current.id], + 'default_is_company': True, + 'default_is_cooperative': True, + 'default_company_type': 'company', + 'default_project_status': '5_suivi'}, 'target': 'current', } # @api.multi # def action_deces(self): - + + +class ScopPartnerCategory(models.Model): + _inherit = "res.partner.category" + + def _default_ur(self): + return self.env['res.company']._ur_default_get() + + id_riga = fields.Integer("ID RIGA") + ur_id = fields.Many2one( + 'union.regionale', + string='Union Régionale', + index=True, + on_delete='restrict', + default=_default_ur) + + class ResPartneCertification(models.Model): _name = "res.partner.certification" _description = "Certification" diff --git a/views/res_partner.xml b/views/res_partner.xml index 15cf6d4de4c14d2d2ed7ea3ee84f7be97d60d222..1e2bb2dba17079a7aeb5c2beef800bcf01ccd2f3 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -56,7 +56,7 @@ modifiers="{'readonly':['|','&',['type','=','contact'],['parent_id','!=',false],['is_cooperative','=',True]]}"/> <field name="street3" placeholder="Rue 3..." class="o_address_street" attrs="{'readonly': ['|', '&', ('type', '=', 'contact'), ('parent_id', '!=', False), ('is_cooperative','=',True)]}" modifiers="{'readonly':['|','&',['type','=','contact'],['parent_id','!=',false],['is_cooperative','=',True]]}"/> - <field name="zip_id" options="{'create_name_field': 'city', 'no_open': True, 'no_create': True}" placeholder="Location completion" class="oe_edit_only" + <field name="zip_id" options="{'create_name_field': 'city', 'no_open': True, 'no_create': True}" placeholder="CP - Ville autocompletion..." class="oe_edit_only" attrs="{'readonly': ['|', '&', ('type', '=', 'contact'), ('parent_id', '!=', False), ('is_cooperative','=',True)]}" on_change="1" can_create="true" can_write="true" modifiers="{'readonly':['|','&',['type','=','contact'],['parent_id','!=',false],['is_cooperative','=',True]]}"/> @@ -91,7 +91,7 @@ <xpath expr='//form/sheet/group/group[2]' position="replace"> <group name="Infos activités" attrs="{'invisible': [('is_company','=', False)]}"> <field name="certification_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" attrs="{'invisible': [('is_company','=', False)]}"/> - <field name="category_id" string="Territoire Rattaché" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" placeholder="Territoire Rattaché..." can_create="true" can_write="true" modifiers="{}" attrs="{'invisible': [('is_company','=', False)]}"/> + <field name="category_id" string="Segmentation" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" placeholder="Territoire Rattaché..." can_create="true" can_write="true" modifiers="{}" attrs="{'invisible': [('is_company','=', False)]}" domain="[('ur_id', '=', ur_id)]"/> <field name="industry_id" attrs="{'invisible': [('is_company','=', False)]}"/> <field name="organization_type_id" attrs="{'invisible': [('is_company','=', False)]}"/> <field name="organization_subtype_id" attrs="{'invisible': [('is_company','=', False)]}"/> diff --git a/views/res_partner_cooperative.xml b/views/res_partner_cooperative.xml index 54b3680de384a2a7a403a0a13175c5cd39109760..4821987bd9dd61a4162dbf9288c09b116d2e39ee 100644 --- a/views/res_partner_cooperative.xml +++ b/views/res_partner_cooperative.xml @@ -253,7 +253,7 @@ <field name="followup_delegate_id" widget="res_partner_many2one" attrs="{'required':[('project_status','in',('5_suivi'))]}"/> <field name="revision_person_id" widget="res_partner_many2one" readonly="True"/> <field name="parent_group_name"/> - <field name="category_id" string="Segmentation" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/> + <field name="category_id" string="Segmentation" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}" domain="[('ur_id', '=', ur_id)]"/> </group> <group string="Informations Activité"> <field name="creation_origin_id" required="True"/>