diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 732d0c4a644eb444d6b4385643ff32fab19fab52..4acca684ec8c5cda7b3ecd21b9e568ab03d57e8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,8 @@ exclude: | ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| + # Maybe reactivate this when all README files include prettier ignore tags? + ^README\.md$| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| # Repos using Sphinx to generate docs don't need prettying @@ -25,8 +27,13 @@ repos: entry: found forbidden files; remove them language: fail files: "\\.rej$" + - id: en-po-files + name: en.po files cannot exist + entry: found a en.po file + language: fail + files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 7d8a9f9ad73db0976fb03cbee43d953bc29b89e9 + rev: ab1d7f6 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -48,7 +55,7 @@ repos: hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.2 + rev: v2.1.2 hooks: - id: prettier name: prettier (with plugin-xml) @@ -59,7 +66,7 @@ repos: - --plugin=@prettier/plugin-xml files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.15.0 + rev: v7.8.1 hooks: - id: eslint verbose: true @@ -67,7 +74,7 @@ repos: - --color - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v3.2.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -89,37 +96,33 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade - rev: v2.32.1 + rev: v2.7.2 hooks: - id: pyupgrade args: ["--keep-percent-format"] - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort except __init__.py args: - --settings=. exclude: /__init__\.py$ - - repo: https://gitlab.com/PyCQA/flake8 - rev: 3.9.2 + - repo: https://github.com/PyCQA/flake8 + rev: 3.8.3 hooks: - id: flake8 name: flake8 additional_dependencies: ["flake8-bugbear==20.1.4"] - - repo: https://github.com/PyCQA/pylint - rev: v2.11.1 + - repo: https://github.com/OCA/pylint-odoo + rev: 7.0.2 hooks: - - id: pylint + - id: pylint_odoo name: pylint with optional checks args: - --rcfile=.pylintrc - --exit-zero verbose: true - additional_dependencies: &pylint_deps - - pylint-odoo==5.0.5 - - id: pylint - name: pylint with mandatory checks + - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory - additional_dependencies: *pylint_deps diff --git a/datas/scop_contribution_type_data.xml b/datas/scop_contribution_type_data.xml index 668674e39fff5d4e7bae3a53ace7f2bcfeb11702..d45050cf24ddc7586ebc20ea8ee25ac3d11ad57d 100644 --- a/datas/scop_contribution_type_data.xml +++ b/datas/scop_contribution_type_data.xml @@ -16,6 +16,10 @@ <field name="name">Cotisation Fédération CAE</field> </record> + <record id="cotiz_fede_indus" model="scop.contribution.type"> + <field name="name">Cotisation Fédération Industrie</field> + </record> + <record id="riga_14399" model="scop.contribution.type"> <field name="id_riga" eval="14399" /> <field name="name">Cotisation UR</field> diff --git a/models/__init__.py b/models/__init__.py index 6de0dcbceccb8bfa5e655aea32276e9b93f18c99..9128e25057c9aa9fa24ea63d3e6656c1e50fe0f0 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -3,6 +3,7 @@ from . import ir_http from . import res_company +from . import mail_activity from . import mail_activity_type from . import scop_revision from . import scop_membership diff --git a/models/mail_activity.py b/models/mail_activity.py new file mode 100644 index 0000000000000000000000000000000000000000..b716c582e9b880f26d385a66c32abf81a48425dc --- /dev/null +++ b/models/mail_activity.py @@ -0,0 +1,28 @@ +# © 2019 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class MailActivity(models.Model): + _inherit = "mail.activity" + + # ------------------------------------------------------ + # Onchange functions + # ------------------------------------------------------ + @api.onchange("activity_type_id") + def _onchange_activity_type_id(self): + """ + Renvoie un domaine lié aux activités de l'UR de l'utilisateur + """ + domain = { + "domain": { + "activity_type_id": [ + ("ur_id", "=", self.env.company.ur_id.id), + "|", + ("res_model_id", "=", False), + ("res_model_id", "=", self.res_model_id), + ] + } + } + return domain diff --git a/models/res_partner.py b/models/res_partner.py index 0cb244ac0243f0dea07f6dae012cd7d7edbe83f6..e6249c900804f99da756798116bea8f689517116 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -7,7 +7,7 @@ import time from datetime import datetime, timedelta from odoo import _, api, fields, models -from odoo.exceptions import ValidationError +from odoo.exceptions import UserError, ValidationError _logger = logging.getLogger(__name__) @@ -44,8 +44,17 @@ class ScopPartner(models.Model): except Exception: return [("is_company", "=", True)] + # Inherit parent + active = fields.Boolean( + tracking=True, + ) + # Infos générales - champs non affichés is_cooperative = fields.Boolean("Est une coopérative") + parent_is_cooperative = fields.Boolean( + string="Parent est une coopérative", + related="parent_id.is_cooperative", + ) current_user_ur_id = fields.Many2one( "union.regionale", string="Union Régionale de l'utilisateur", @@ -103,11 +112,6 @@ class ScopPartner(models.Model): "No adhérent", group_operator="", ) - member_start_stat = fields.Date( - "Date d'adhésion statistique", - compute="_compute_membership", - store=True, - ) member_start = fields.Date( "Date d'adhésion", compute="_compute_membership", store=True ) @@ -377,6 +381,7 @@ class ScopPartner(models.Model): string="Organisme de révision suppléant", domain=_get_domain_revision_company_id, ondelete="restrict", + tracking=True, ) revision_person_id = fields.Many2one( comodel_name="res.users", @@ -385,7 +390,10 @@ class ScopPartner(models.Model): tracking=True, ) revision_certified_person_id = fields.Many2one( - comodel_name="res.users", string="Réviseur agréé", ondelete="restrict" + comodel_name="res.users", + string="Réviseur agréé", + ondelete="restrict", + tracking=True, ) revision_person_assign_date = fields.Date( string="Date de nomination du réviseur", tracking=True @@ -398,12 +406,14 @@ class ScopPartner(models.Model): ("5ys23", "Quinquennale séquencée (2 ans et 3 ans)"), ], string="Périodicité de la révision", + tracking=True, ) revision_next_date = fields.Date("Prochain exercice révisable (old)") revision_format_id = fields.Many2one( "scop.revision.format", string="Format de révision", ondelete="restrict", + tracking=True, ) revision_tarif = fields.Integer( "Tarif de vente", related="revision_format_id.tarif", store=False @@ -412,11 +422,13 @@ class ScopPartner(models.Model): "Prochain exercice révisable", compute="_compute_revision_next_exercice", store=True, + readonly=False, ) revision_next_year = fields.Integer( "Année prochaine révision", compute="_compute_revision_next_year", store=True, + readonly=False, ) revision_ids = fields.One2many( comodel_name="scop.revision", @@ -853,6 +865,24 @@ class ScopPartner(models.Model): partner.commercial_company_name or partner.sudo().parent_id.name, ) + def action_archive(self): + """ + Lève une erreur si une coopérative qui n'est pas à l'état abandonné fait partie des + items à archiver + """ + coop_ids = self.filtered( + lambda p: p.is_cooperative and p.project_status != "7_abandonne" + ) + if coop_ids: + raise UserError( + _( + "Il n'est pas possible d'archiver une coopérative qui n'est pas en " + "statut abandonné." + ) + ) + else: + return super().action_archive() + # ------------------------------------------------------ # Computed Fields # ------------------------------------------------------ @@ -986,6 +1016,7 @@ class ScopPartner(models.Model): "membership_period_ids", "membership_period_ids.end_reason_id", "membership_period_ids.end", + "membership_period_ids.start", ) # Todo: A revoir comment on assigne le statut member def _compute_membership(self): @@ -999,7 +1030,6 @@ class ScopPartner(models.Model): ) if last_membership_period and not last_membership_period.end: partner.membership_status = "member" - partner.member_start_stat = last_membership_period.start_stat partner.member_start = last_membership_period.start elif last_membership_period and last_membership_period.end_reason_id: partner.membership_status = "out" diff --git a/models/scop_membership.py b/models/scop_membership.py index e03356286e836083fe34d5be3138a22c7d2411c6..5c85ff595065227b1c7bf6546710ada9c217bd77 100644 --- a/models/scop_membership.py +++ b/models/scop_membership.py @@ -24,7 +24,6 @@ class ScopMembershipPeriod(models.Model): index=True, ) start = fields.Date("Début d’adhésion", index=True) - start_stat = fields.Date("Début d’adhésion stat.", index=True) end = fields.Date("Fin d’adhésion") end_reason_id = fields.Many2one( "scop.membership.reason.end", diff --git a/models/scop_partner_staff.py b/models/scop_partner_staff.py index e79ff86e403c348eb81a93d6903a6f9ce6b036f5..0c736a6a647ed9107de45b6674b72c1cbb82905b 100644 --- a/models/scop_partner_staff.py +++ b/models/scop_partner_staff.py @@ -86,7 +86,7 @@ class ScopPartnerStaff(models.Model): ) staff_shareholder_count = fields.Integer("Nb Sociétaires Salarié") staff_shareholder_total = fields.Integer("Total associés") - staff_average = fields.Integer("Equivalent temps plein (ETP)") + staff_average = fields.Float("Equivalent temps plein (ETP)") staff_men = fields.Integer("Eff. salariés hommes") staff_women = fields.Integer("Eff. salariés femmes") staff_shareholder_men = fields.Integer("Sociétaires salariés hommes") diff --git a/views/res_partner.xml b/views/res_partner.xml index baafbeec3cf98c3b0173702541f32adea967aa12..754dd2aaddf30206f4c07f19bcddecdf3217b538 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -69,17 +69,14 @@ <attribute name="attrs" >{'invisible': [('is_cooperative','=', True)]}</attribute> + <attribute name="col">3</attribute> </xpath> + <xpath expr="//div[hasclass('oe_title')]" position="attributes"> <attribute name="attrs" >{'invisible': [('is_cooperative','=', True)]}</attribute> </xpath> - <xpath expr="//form/sheet/group" position="attributes"> - <attribute - name="attrs" - >{'invisible': [('is_cooperative','=', True)]}</attribute> - </xpath> <!-- Affiche les champs de la vue partenaire --> <field name="parent_id" position="before"> @@ -96,6 +93,9 @@ name="domain" >[('is_company', '=', True), ('ur_id', '=', ur_id)]</attribute> <attribute name="placeholder">Société</attribute> + <attribute + name="attrs" + >{'invisible': [('is_company','=', True)]}</attribute> </field> <xpath expr="//div[hasclass('oe_title')]" position="attributes"> <attribute name="class">oe_title oe_title_cgscop</attribute> @@ -119,6 +119,7 @@ >base.group_no_one,cgscop_partner.group_cg_administrator</attribute> <attribute name="readonly">True</attribute> </xpath> + <field name="street" position="attributes"> <attribute name="placeholder">Rue</attribute> </field> @@ -148,7 +149,123 @@ <attribute name="placeholder">Région</attribute> <attribute name="invisible">1</attribute> </field> + + <field name="vat" position="attributes"> + <attribute + name="attrs" + >{'invisible': [('is_company','=', False)]}</attribute> + </field> + + <field name="vat" position="before"> + <field name="user_ids" invisible="1" /> + <field + name="zip_departement" + string="N° de département" + attrs="{'invisible': [('is_company','=', False)]}" + /> + <field + name="region" + attrs="{'invisible': [('is_company','=', False)]}" + /> + </field> + + <field name="vat" position="after"> + <field name="phone" widget="phone" /> + <field + name="mobile" + widget="phone" + attrs="{'invisible': [('is_company','=', True)]}" + /> + <field name="email" widget="email" on_change="1" /> + <field + name="website" + attrs="{'invisible': [('is_company','=', False)]}" + /> + <field name="lang" invisible="1" /> + </field> + <xpath expr='//form/sheet/group/group[2]' position="replace"> + <group col="1" name="partner_legal_info"> + <group + string="Informations juridiques" + attrs="{'invisible': [('is_company', '=', False)]}" + > + <label + for="siret" + class="oe_edit_only" + attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" + /> + <div> + <field + name="siret" + class="oe_edit_only" + attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" + /> + </div> + <label + for="formatted_siret" + class="oe_read_only" + string="SIRET" + attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" + /> + <div> + <field + name="formatted_siret" + class="oe_read_only" + string="SIRET" + attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" + /> + </div> + <field + name="partner_company_type_id" + options="{'no_create': 1}" + /> + <field name="registration_date" /> + </group> + + <group + string="Informations contact" + name="contact_legal_info" + attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}" + > + <field name="parent_is_cooperative" invisible="1" /> + + <field + name="title" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': [('is_company','=', True)]}" + /> + <field + name="birthyear" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <br /> + <field + name="mandate_id" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="function_lst_id" + options='{"no_create": True, "no_open": True}' + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', True)]}" + /> + <field + name="function" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="employee" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + <field + name="associate" + attrs="{'invisible': ['|',('is_company','=', True),('parent_is_cooperative','=', False)]}" + /> + </group> + + </group> + <group col="1" name="partner_segment_info" @@ -210,16 +327,26 @@ domain="[('ur_id', '=', ur_id)]" attrs="{'invisible':[('segment_4_nb', '=', 0)]}" /> + <field + name="staff_last" + attrs="{'invisible': [('organization_subtype_id','!=', %(cgscop_partner.riga_11528)d)]}" + /> + <br /> + <field + name="ur_id" + options='{"no_open": True, "no_create": True}' + on_change="1" + can_create="false" + can_write="false" + attrs="{'invisible': [('is_company','=', False)]}" + /> <field name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': ['|', ('is_company','=', False), ('type', '!=', 'contact')]}" /> - <field - name="staff_last" - attrs="{'invisible': [('organization_subtype_id','!=', %(cgscop_partner.riga_11528)d)]}" - /> </group> <group string="Féd. communication" @@ -232,40 +359,14 @@ widget="many2many_tags" /> </group> - </group> <group + string="Informations mouvement" name="contact_segment_info" attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}" > - <field - name="title" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="mandate_id" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="function_lst_id" - options='{"no_create": True, "no_open": True}' - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field name="function" /> - <field - name="employee" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="associate" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field - name="birthyear" - attrs="{'invisible': [('is_company','=', True)]}" - /> + <field name="parent_is_cooperative" invisible="1" /> + <field name="contact_origin_id" attrs="{'invisible': [('is_company','=', True)]}" @@ -276,13 +377,30 @@ readonly="True" attrs="{'invisible': [('is_company','=', True)]}" /> + <br /> + <field + name="ur_id" + options='{"no_open": True, "no_create": True}' + on_change="1" + can_create="false" + can_write="false" + /> <field name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> + <br /> + <field + name="category_id" + options='{"no_open": True, "no_create": True}' + widget="many2many_tags" + /> + </group> </xpath> + <xpath expr='//form/sheet/group' position="after"> <field name="subscription_ids" @@ -294,227 +412,168 @@ </tree> </field> </xpath> - <xpath expr="//field[@name='child_ids']" position="attributes"> - <attribute - name="context" - >{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_street3': street3, 'default_city': city, 'default_cedex': cedex, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_lang': lang, 'default_ur_id': ur_id, 'default_user_id': user_id}</attribute> - </xpath> - <!-- Kanban Child --> - <xpath - expr="//field[@name='child_ids']//kanban//field[@name='function']" - position="before" - > - <field name="mandate_id" /> - <field - name="ur_id" - options='{"no_open": True, "no_create": True}' - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//kanban//div[hasclass('oe_kanban_details')]//field[@name='name']" - position="after" - > - <div t-if="record.mandate_id.raw_value"><field - name="mandate_id" - /></div> - </xpath> - <!-- Form Child --> - <xpath - expr="//field[@name='child_ids']//form//field[@name='type']" - position="after" - > - <field - name="company_type" - widget="radio" - class="oe_edit_only" - options="{'horizontal': true}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='function']" - position="replace" - > - <field - name="ur_id" - invisible="1" - options='{"no_open": True, "no_create": True}' - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street']" - position="attributes" - > - <attribute name="placeholder">Rue</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street2']" - position="attributes" - > - <attribute name="placeholder">Rue 2</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='street3']" - position="attributes" - > - <attribute name="placeholder">Rue 3</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='zip_id']" - position="attributes" - > - <attribute - name="placeholder" - >CP / Ville autocomplétion...</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='zip']" - position="replace" - /> - <xpath - expr="//field[@name='child_ids']//form//field[@name='city']" - position="before" - > - <field - name="zip" - placeholder="Code postal" - class="o_address_city" - attrs="{'readonly': [('type', '=', 'contact'), ('parent_id', '!=', False)]}" - on_change="1" - modifiers="{'readonly':[['type','=','contact'], ['parent_id','!=',false]]}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='state_id']" - position="attributes" - > - <attribute name="placeholder">Région</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='mobile']" - position="after" - > - <field - name="category_id" - options='{"no_open": True, "no_create": True}' - widget="many2many_tags" - attrs="{'invisible': [('type', '!=', 'contact')]}" - /> - </xpath> - <xpath - expr="//field[@name='child_ids']//form//field[@name='title']" - position="attributes" - > - <attribute - name="options" - >{'no_open': True, 'no_create': True}</attribute> - </xpath> - <xpath - expr="//field[@name='child_ids']/form//group/group[2]" - position="after" - > - <group attrs="{'invisible': [('type', '!=', 'contact')]}"> - <field - name="mandate_id" - options='{"no_open": True, "no_create": True}' - /> - <field - name="function_lst_id" - options='{"no_open": True, "no_create": True}' - /> - <field name="function" /> - <field name="employee" /> - <field name="associate" /> - <field name="birthyear" /> - <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" - /> - <field name="contact_legality" readonly="1" /> - <field - name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + + <xpath expr="//field[@name='child_ids']" position="replace"> + <p> + <button + name="add_contact" + type="object" + class="btn-info" + string="Ajouter un contact" /> - </group> - </xpath> - <xpath expr="//field[@name='child_ids']/form//group" position="after"> + </p> + <field - name="subscription_ids" - attrs="{'invisible': [('type', '!=', 'contact')]}" + name="child_ids" + mode="kanban" + readonly="1" + style="pointer-events: none;" > - <tree string="Subscriptions" editable="bottom"> - <field name="newsletter_id" domain="[]" /> - <field name="consent" /> - </tree> + <kanban> + <field name="id" /> + <field name="color" /> + <field name="name" /> + <field name="title" /> + <field name="type" /> + <field name="email" /> + <field name="parent_id" /> + <field name="is_company" /> + <field name="mandate_id" /> + <field name="function" /> + <field name="function_lst_id" /> + <field name="phone" /> + <field name="street" /> + <field name="street2" /> + <field name="street3" /> + <field name="zip" /> + <field name="zip_id" /> + <field name="city" /> + <field name="city_id" /> + <field name="cedex" /> + <field name="country_id" /> + <field name="mobile" /> + <field name="state_id" /> + <field name="image_128" /> + <field name="lang" /> + <field name="comment" /> + <field name="display_name" /> + <field name="ur_id" /> + <field name="category_id" /> + <templates> + <t t-name="kanban-box"> + <t + t-set="color" + t-value="kanban_color(record.color.raw_value)" + /> + <div + t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '') + ' oe_kanban_global_click'" + > + <a + name="edit_contact" + type="object" + class="fa fa-2x fa-edit text-info pull-right" + title="Modifier" + style="pointer-events: visible;" + /> + <a + t-if="!read_only_mode" + name="partner_archive" + type="object" + class="fa fa-times pull-right" + title="Archiver" + /> + <div class="o_kanban_image"> + <img + alt="Contact image" + t-if="record.image_128.raw_value" + t-att-src="kanban_image('res.partner', 'image_128', record.id.raw_value)" + /> + <t t-if="!record.image_128.raw_value"> + <img + alt="Delivery" + t-if="record.type.raw_value === 'delivery'" + t-att-src='_s + "/base/static/img/truck.png"' + /> + <img + id="cgscop_partner_invoice_img" + alt="Invoice" + t-if="record.type.raw_value === 'invoice'" + t-att-src='_s + "/base/static/img/money.png"' + /> + <t + t-if="record.type.raw_value !== 'invoice' && record.type.raw_value !== 'delivery'" + > + <img + alt="Logo" + t-if="record.is_company.raw_value === true" + t-att-src="_s + '/base/static/img/company_image.png'" + /> + <img + alt="Avatar" + t-if="record.is_company.raw_value === false" + t-att-src='_s + "/base/static/img/avatar_grey.png"' + /> + </t> + </t> + </div> + <div class="oe_kanban_details"> + <field name="name" /> + <div + t-if="record.function_lst_id.raw_value" + ><field name="function_lst_id" /></div> + <div + t-if="record.email.raw_value" + ><field name="email" widget="email" /></div> + <div + t-if="record.type.raw_value != 'contact'" + > + <div> + <field name="zip" /> + <field name="city" /> + <field name="cedex" /> + </div> + <field + t-if="record.state_id.raw_value" + name="state_id" + /> + <field name="country_id" /> + </div> + <div + t-if="record.phone.raw_value" + >Phone: <field name="phone" /></div> + <div + t-if="record.mobile.raw_value" + >Mobile: <field name="mobile" /></div> + <div + t-if="record.category_id.raw_value" + ><field + name="category_id" + widget="many2many_tags" + /></div> + </div> + </div> + </t> + </templates> + </kanban> </field> </xpath> - <field name="vat" position="after"> - <field name="user_ids" invisible="1" /> - <field name="zip_departement" string="N° de département" /> - <field name="region" /> - <field name="phone" widget="phone" /> - <field - name="mobile" - widget="phone" - attrs="{'invisible': [('is_company','=', True)]}" - /> - <field name="email" widget="email" on_change="1" /> - <field - name="website" - attrs="{'invisible': [('is_company','=', False)]}" - /> - <label - for="siret" - class="oe_edit_only" - attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" - /> - <div> - <field - name="siret" - class="oe_edit_only" - attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" - /> - </div> - <label - for="formatted_siret" - class="oe_read_only" - string="SIRET" - attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" - /> - <div> - <field - name="formatted_siret" - class="oe_read_only" - string="SIRET" - attrs="{'invisible': [('is_company','=', False), ('is_cooperative','=', False)]}" - /> - </div> - <field - name="ur_id" - options='{"no_open": True, "no_create": True}' - on_change="1" - can_create="false" - can_write="false" - /> - <field - name="category_id" - options='{"no_open": True, "no_create": True}' - widget="many2many_tags" - attrs="{'invisible': ['|', ('is_company', '=', True), ('type', '!=', 'contact')]}" - /> - <field name="lang" invisible="1" /> - </field> - <xpath expr="//notebook/page" position="attributes"> + + <xpath + expr="//notebook/page[@name='contact_addresses']" + position="attributes" + > <attribute name="attrs" - >{'invisible': [('is_cooperative','=', True)]}</attribute> + >{'invisible': ['|', ('is_cooperative','=', True), ('is_company','!=', True)]}</attribute> </xpath> + <xpath expr="//notebook/page[@name='internal_notes']" position="attributes" > <attribute name="string">Commentaires</attribute> </xpath> + <xpath expr="//field[@name='comment']" position="attributes"> <attribute name="placeholder">Commentaires...</attribute> </xpath> @@ -935,18 +994,21 @@ <field name="creation_delegate_id" attrs="{'required':['|', ('membership_status','in',('adhesion', 'soumis_cg')), ('project_status','in',('3_accompagnement'))], 'invisible':[('project_status', 'in', '4_suivi')]}" - options="{'no_open': True, 'no_create': True}" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" + widget="many2one_mailto" domain="[('ur_id', '=', ur_id)]" /> <field name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" attrs="{'invisible': [('project_status', 'in', ('1_information', '2_pre-diagnostic', '3_accompagnement'))]}" /> <field name="support_delegate_id" - options="{'no_open': True, 'no_create': True}" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> <field @@ -1156,7 +1218,11 @@ string="Ajouter un dirigeant" /> </p> - <field name="director_ids" readonly="1"> + <field + name="director_ids" + readonly="1" + style="pointer-events:none;" + > <kanban> <field name="id" /> <field name="color" /> @@ -1207,6 +1273,7 @@ type="object" class="fa fa-2x fa-edit text-info pull-right" title="Modifier" + style="pointer-events: visible;" /> <div class="o_kanban_image"> <img @@ -1272,7 +1339,12 @@ string="Ajouter un contact" /> </p> - <field name="other_child_ids" mode="kanban" readonly="1"> + <field + name="other_child_ids" + mode="kanban" + readonly="1" + style="pointer-events: none;" + > <kanban> <field name="id" /> <field name="color" /> @@ -1316,6 +1388,7 @@ type="object" class="fa fa-2x fa-edit text-info pull-right" title="Modifier" + style="pointer-events: visible;" /> <a t-if="!read_only_mode" @@ -1533,7 +1606,7 @@ <field name="start" /> <field name="type_id" /> <field name="number" /> - <field name="start_stat" /> + <field name="start" /> <field name="end" /> <field name="end_reason_id" /> <field name="note" /> @@ -1785,15 +1858,25 @@ string="Nom de famille" required="1" /> + <field name="birthyear" /> + <br /> <field name="email" /> <field name="phone" widget="phone" /> <field name="mobile" widget="phone" /> + <br /> <field - name="category_id" - widget="many2many_tags" - options="{'color_field': 'color', 'no_create': True}" + name="contact_origin_id" + options="{'no_open': True, 'no_create': True}" + /> + <field name="contact_legality" readonly="1" /> + <br /> + <field name="ur_id" readonly="1" /> + <field + name="followup_delegate_id" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" + domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> - <field name="comment" placeholder="Commentaires..." /> </group> <group> <field @@ -1801,25 +1884,15 @@ options="{'no_open': True, 'no_create': True}" required="1" /> - <field - name="function_lst_id" - options="{'no_open': True, 'no_create': True}" - /> <field name="function" /> <field name="employee" /> <field name="associate" /> - <field name="birthyear" /> + <br /> <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" - /> - <field name="contact_legality" readonly="1" /> - <field - name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + name="category_id" + widget="many2many_tags" + options="{'color_field': 'color', 'no_create': True}" /> - <field name="ur_id" readonly="1" /> </group> </group> <field name="subscription_ids"> @@ -1875,10 +1948,12 @@ /> <field name="parent_id_onchange" invisible="1" /> <field name="parent_id" invisible="1" /> + <field name="parent_is_cooperative" invisible="1" /> <hr /> <group> <group attrs="{'invisible': [('type', '=', 'contact')]}"> - <label for="street" string="Address" /> + <field name="name" string="Nom" required="1" /> + <label for="street" string="Adresse" /> <div> <div name="div_address" class="o_address_format"> <field @@ -1938,18 +2013,13 @@ </div> </div> </group> - <group> + <group attrs="{'invisible': [('type', '!=', 'contact')]}"> <field name="title" placeholder="Madame" attrs="{'invisible': [('type','!=', 'contact')]}" options='{"no_open": True, "no_create": True}' /> - <field - name="name" - string="Nom" - attrs="{'required' : [('type', '!=', 'contact')], 'invisible' : [('type', '=', 'contact')]}" - /> <field name="firstname" string="Prénom" @@ -1960,41 +2030,58 @@ string="Nom de famille" attrs="{'required' : [('type', '=', 'contact')], 'invisible' : [('type', '!=', 'contact')]}" /> + <field + name="birthyear" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <br /> <field name="email" /> <field name="phone" widget="phone" /> <field name="mobile" widget="phone" /> + <br /> <field - name="category_id" - widget="many2many_tags" - options="{'color_field': 'color', 'no_create': True}" - attrs="{'invisible': [('type','!=', 'contact')]}" + name="contact_origin_id" + options="{'no_open': True, 'no_create': True}" + /> + <field name="contact_legality" readonly="1" /> + <br /> + <field name="ur_id" readonly="1" /> + <field + name="followup_delegate_id" + widget="many2one_mailto" + options="{'no_open': True, 'no_create': True, 'mailto_field': 'email'}" + domain="[('active', '=', True),('ur_id', '=', ur_id)]" /> - <field name="comment" placeholder="internal note..." /> </group> <group attrs="{'invisible': [('type', '!=', 'contact')]}"> <field name="mandate_id" options="{'no_open': True, 'no_create': True}" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <field + name="function" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" /> <field name="function_lst_id" options="{'no_open': True, 'no_create': True}" + attrs="{'invisible': [('parent_is_cooperative','!=', False)]}" /> - <field name="function" /> - <field name="employee" /> - <field name="associate" /> - <field name="birthyear" /> <field - name="contact_origin_id" - options="{'no_open': True, 'no_create': True}" + name="employee" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" /> - <field name="contact_legality" readonly="1" /> <field - name="followup_delegate_id" - options="{'no_open': True, 'no_create': True}" - domain="[('active', '=', True),('ur_id', '=', ur_id)]" + name="associate" + attrs="{'invisible': [('parent_is_cooperative','=', False)]}" + /> + <br /> + <field + name="category_id" + widget="many2many_tags" + options="{'color_field': 'color', 'no_create': True}" /> - <field name="ur_id" readonly="1" /> </group> </group> <field diff --git a/views/res_partner_cooperative.xml b/views/res_partner_cooperative.xml index c6142140b77fa29120c5a485e843b607b505b148..c725c60fd67767d3b813fb67ebcdec4f590d3d6d 100644 --- a/views/res_partner_cooperative.xml +++ b/views/res_partner_cooperative.xml @@ -79,11 +79,6 @@ name="member_start_this_year" domain="[('member_start','<=', time.strftime('%%Y-12-31')),('member_start','>=',time.strftime('%%Y-01-01'))]" /> - <filter - string="Adhésions cette année (stat)" - name="member_start_stat_this_year" - domain="[('member_start_stat','<=', time.strftime('%%Y-12-31')),('member_start_stat','>=',time.strftime('%%Y-01-01'))]" - /> <filter string="Coop. non Adhérentes, non décédées" name="is_not_member" diff --git a/views/scop_config_lists_views.xml b/views/scop_config_lists_views.xml index 4bc596f72afb6023e81480b32ac4780d81b65ddd..07a92edbe8b53a5e76fb14716a98f74a3d149eb5 100644 --- a/views/scop_config_lists_views.xml +++ b/views/scop_config_lists_views.xml @@ -97,7 +97,6 @@ <field name="name">Formats de Révision</field> <field name="res_model">scop.revision.format</field> <field name="view_mode">tree</field> - <field name="domain">[('ur_id', '=', ur_id)]</field> <field name="help">Affiche et gère la liste des Formats de Révision.</field> </record> diff --git a/views/scop_config_views.xml b/views/scop_config_views.xml index 0e2f9f71efe5f32dd7c41a7fd3866745a41133ce..70f2e09f343f99054adcdceec10a218e29a7ae16 100644 --- a/views/scop_config_views.xml +++ b/views/scop_config_views.xml @@ -451,10 +451,6 @@ </field> </record> - <record id="mail.mail_activity_type_action" model="ir.actions.act_window"> - <field name="domain">[('ur_id', '=', ur_id)]</field> - </record> - <!-- MENUS --> <menuitem diff --git a/views/scop_period_views.xml b/views/scop_period_views.xml index 1fb0c84111b9cbb765e2b46f96a08af3e03a4c99..1e806ae2f4a31be72ef6bbf2b9f703c8ee30292e 100644 --- a/views/scop_period_views.xml +++ b/views/scop_period_views.xml @@ -104,7 +104,7 @@ options="{'no_open': True, 'no_create': True}" /> <field name="number" /> - <field name="start_stat" /> + <field name="start" /> <field name="end" /> <field name="end_reason_id" diff --git a/wizard/scop_membership_period_wizard.py b/wizard/scop_membership_period_wizard.py index 95b8e8ce0308c52e282cfa9077ceee15302dea32..3929a9551f168596bacb060b209e368a5d4777cd 100644 --- a/wizard/scop_membership_period_wizard.py +++ b/wizard/scop_membership_period_wizard.py @@ -28,9 +28,6 @@ class ScopMembershipPeriodWizard(models.TransientModel): required=True, ) start = fields.Date("Début d’adhésion", required=True, default=fields.Date.today()) - start_stat = fields.Date( - "Début d’adhésion stat.", required=True, default=fields.Date.today() - ) number = fields.Char("No adhérent", required=True, default=_default_number) note = fields.Text("Commentaires") @@ -54,14 +51,7 @@ class ScopMembershipPeriodWizard(models.TransientModel): "partner_id": period.partner_id, "type_id": period.type_id.id, "start": period.start, - "start_stat": period.start_stat, "number": period.number, "note": period.note, } ) - - @api.onchange("start") - def onchange_start(self): - for rec in self: - if rec.start: - rec.start_stat = rec.start diff --git a/wizard/scop_membership_period_wizard.xml b/wizard/scop_membership_period_wizard.xml index 8b5d0f0d72b7c8d3085b3fede7a6736644c620b7..e04dd389a6947c1c1e407ce9a7b8dd60d96f8b58 100644 --- a/wizard/scop_membership_period_wizard.xml +++ b/wizard/scop_membership_period_wizard.xml @@ -12,7 +12,6 @@ options="{'no_open': True, 'no_create': True}" /> <field name="start" /> - <field name="start_stat" /> <field name="number" /> <field name="note" /> </group>