diff --git a/__manifest__.py b/__manifest__.py index 96388a00d3d5054869c75b63e3dce0d4780cd0d3..ea204bb7cfe393e78be098f7f0610dd18c7a1d4d 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -6,6 +6,7 @@ "version": "18.0.1.0.0", "license": "AGPL-3", "depends": [ + "company_shares", "financial_contract", "financial_contract_external", ], @@ -17,6 +18,7 @@ # views "views/financial_contract_guarantee.xml", "views/financial_contract_guarantee_line.xml", + "views/financial_contract_guarantee_partner.xml", "views/financial_product_template_guarantee.xml", "views/res_config_settings.xml", "views/res_partner.xml", @@ -25,11 +27,9 @@ # wizard ], "assets": { - "web._assets_primary_variables": [], - "web._assets_frontend_helpers": [], - "web.assets_frontend": [], - "web.assets_tests": [], - "web.assets_qweb": [], + "web.assets_backend": [ + 'financial_contract_guarantee/static/src/components/**/*', + ], }, "installable": True, "auto_install": False, diff --git a/models/__init__.py b/models/__init__.py index 2708798798c3f7cf1b3069c3d0d9c0a8afb15d75..4eda44ccf95dfe104f6c9e007ecae45ef301dc0d 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,4 +1,5 @@ from . import financial_contract_guarantee +from . import financial_contract_guarantee_partner from . import financial_contract_guarantee_line from . import financial_contract_guarantee_suspensive_condition from . import financial_product_guarantee_suspensive_condition diff --git a/models/financial_contract_guarantee.py b/models/financial_contract_guarantee.py index ec8f10ebd7c4cb7afaf65c74cdf7d0e84cd00092..d63e07d2eb1793ec721a2c00200c409ebe5b0883 100644 --- a/models/financial_contract_guarantee.py +++ b/models/financial_contract_guarantee.py @@ -1,7 +1,8 @@ # © 2024 Le Filament (<http://www.le-filament.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import Command, api, fields, models +from odoo import _, api, Command, fields, models +from odoo.exceptions import ValidationError class FinancialContractGuarantee(models.Model): @@ -45,45 +46,69 @@ class FinancialContractGuarantee(models.Model): related="external_loan_id.number", store=True, ) - + guarantee_rate = fields.Float("Quotité garantie", tracking=1) + initial_guarantee_amount = fields.Monetary( + string="Montant initial garanti", + compute="_compute_initial_guarantee_amount", + store=True, + ) + guarantee_amount = fields.Monetary( + compute="_compute_guarantee_amount", + string="En cours de garantie", + store=True, + tracking=1, + ) is_counter_guarantee = fields.Boolean("Contre Garantie", default=False) - fmg_amount = fields.Monetary("Montant FMG") - social_share_amount = fields.Monetary("Montant parts sociales") + counter_guarantee_rate = fields.Float("Quotité contre garantie") + counter_guarantee_partner_id = fields.Many2one( + comodel_name="financial.contract.guarantee.partner", + string="Partenaire" + ) final_risk_guarantee = fields.Monetary( string="Garantie risque final", compute="_compute_final_risk_guarantee", store=True, tracking=1, ) - + fmg_amount = fields.Monetary( + string="Montant FMG", + compute="_compute_fmg_amount", + store=True, + ) + social_share_number = fields.Integer( + string="Nbre parts sociales", + compute="_compute_social_share", + store=True + ) + social_share_amount = fields.Monetary( + string="Montant parts sociales", + compute="_compute_social_share", + store=True + ) line_ids = fields.One2many( comodel_name="financial.contract.guarantee.line", inverse_name="guarantee_id", string="Lignes de solde", ) - # loan_balance = fields.Monetary( - # string="Solde créance", - # compute="_compute_balance", - # store=True, - # tracking=2, - # ) - # guarantee_balance = fields.Monetary( - # string="Solde Garantie", - # compute="_compute_balance", - # store=True, - # tracking=2, - # ) - # Loan Data payment_date = fields.Date("Date de versement") - amount_initial = fields.Monetary("Montant initial") + amount_initial = fields.Monetary( + string="Montant initial", + compute="_compute_amount_initial", + store=True, + readonly=False, + ) amount_received = fields.Monetary("Montant reçu") end_date = fields.Date("Date de fin de prêt") - remaining_capital = fields.Monetary("Capital restant dû") - loan_duration = fields.Integer("Durée du crédit") - guarantee_rate = fields.Float("Quotité garantie") - guarantee_amount = fields.Monetary("En cours garanti") + remaining_capital = fields.Monetary("Capital restant dû", tracking=1) + loan_duration = fields.Integer( + string="Durée du crédit (mois)", + compute="_compute_loan_duration", + store=True, + readonly=False, + ) + # Company Data segment_code = fields.Char("Code Segment") bdf_scoring = fields.Char( @@ -112,6 +137,18 @@ class FinancialContractGuarantee(models.Model): # ------------------------------------------------------ # Computed fields / Search Fields # ------------------------------------------------------ + @api.depends("external_loan_id", "external_loan_id.amount") + def _compute_amount_initial(self): + for guarantee in self: + if guarantee.external_loan_id: + guarantee.amount_initial = guarantee.external_loan_id.amount + + @api.depends("external_loan_id", "external_loan_id.duration") + def _compute_loan_duration(self): + for guarantee in self: + if guarantee.external_loan_id: + guarantee.loan_duration = guarantee.external_loan_id.duration + @api.depends( "line_ids", "line_ids.bdf_scoring", @@ -125,22 +162,57 @@ class FinancialContractGuarantee(models.Model): "line_ids", "line_ids.commission_amount", ) - def _compute_guarantee_data(self): + def _compute_commission_amount(self): for guarantee in self: guarantee.commission_amount = sum( guarantee.line_ids.mapped("commission_amount") ) - # @api.depends() - # def _compute_balance(self): - # for guarantee in self: - # guarantee.loan_balance = 0 - # guarantee.guarantee_balance = 0 - - @api.depends() + @api.depends("guarantee_amount", "is_counter_guarantee", "counter_guarantee_rate") def _compute_final_risk_guarantee(self): for guarantee in self: - guarantee.final_risk_guarantee = 0 + if not guarantee.is_counter_guarantee: + guarantee.final_risk_guarantee = guarantee.guarantee_amount + else: + guarantee.final_risk_guarantee = (1 - guarantee.counter_guarantee_rate) * guarantee.guarantee_amount + + @api.depends("remaining_capital", "guarantee_rate") + def _compute_guarantee_amount(self): + for guarantee in self: + guarantee.guarantee_amount = guarantee.remaining_capital * guarantee.guarantee_rate + + @api.depends("amount_initial", "guarantee_rate") + def _compute_initial_guarantee_amount(self): + for guarantee in self: + guarantee.initial_guarantee_amount = guarantee.amount_initial * guarantee.guarantee_rate + + @api.depends("initial_guarantee_amount") + def _compute_fmg_amount(self): + fmg_rate = self.company_id.fmg_rate + if not fmg_rate or fmg_rate == 0.0: + raise ValidationError(_("Le taux de FMG n'est pas configuré.")) + for guarantee in self: + guarantee.fmg_amount = fmg_rate * guarantee.initial_guarantee_amount + + @api.depends("initial_guarantee_amount", "partner_id") + def _compute_social_share(self): + """ + Calcule nombre et montant des parts sociales en fonction : + - du taux défini sur la société + - du montant max défini sur la société + - du prix unitaire de la part défini sur la société + - des prises de parts existantes sur la société + :return: affecte les valeurs de montant et nombre de parts + """ + social_share_rate = self.company_id.social_share_rate + social_share_amount_max = self.company_id.social_share_amount_max + share_unit_price = self.company_id.share_unit_price + for guarantee in self: + max_amount = social_share_amount_max - guarantee.partner_id.company_share_total + rate_amount = social_share_rate * guarantee.initial_guarantee_amount + final_amount = rate_amount if rate_amount <= max_amount else max_amount + guarantee.social_share_number = (final_amount // share_unit_price) + guarantee.social_share_amount = guarantee.social_share_number * share_unit_price @api.depends("product_id") def _compute_suspensive_condition_ids(self): @@ -167,6 +239,12 @@ class FinancialContractGuarantee(models.Model): def _onchange_product_id(self): self._set_product_values() + @api.onchange("is_counter_guarantee") + def _onchange_is_counter_guarantee(self): + if not self.is_counter_guarantee: + self.counter_guarantee_rate = 0.0 + self.counter_guarantee_partner_id = False + # ------------------------------------------------------ # Actions # ------------------------------------------------------ diff --git a/models/financial_contract_guarantee_line.py b/models/financial_contract_guarantee_line.py index b787418c50481957651525b3f35c7e9bcc92e247..6b7c17baf28e219f99f7216ed0891a2f2159fa24 100644 --- a/models/financial_contract_guarantee_line.py +++ b/models/financial_contract_guarantee_line.py @@ -48,6 +48,7 @@ class FinancialContractGuaranteeLine(models.Model): loan_duration = fields.Integer("Durée du crédit") guarantee_rate = fields.Float("Quotité garantie") guarantee_amount = fields.Monetary("En cours garanti") + # Company Data segment_code = fields.Char("Code Segment") bdf_scoring = fields.Char("Cotation BDF") diff --git a/models/financial_contract_guarantee_partner.py b/models/financial_contract_guarantee_partner.py new file mode 100644 index 0000000000000000000000000000000000000000..20f16db157838d139f84e356c1f4366f88150b4d --- /dev/null +++ b/models/financial_contract_guarantee_partner.py @@ -0,0 +1,17 @@ +# © 2024 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class FinancialContractGuaranteePartner(models.Model): + _name = "financial.contract.guarantee.partner" + _description = "External partner contractor" + _order = "name" + + name = fields.Char(string="Nom", required=True) + active = fields.Boolean(default=True) + + # ------------------------------------------------------ + # Computed fields / Search Fields + # ------------------------------------------------------ diff --git a/models/res_company.py b/models/res_company.py index 016004a5f4d4f2836559ad7d7e125098f5bee81a..efd67b90dba7d99f80947110e25d1a328c922735 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -14,6 +14,9 @@ class ResCompany(models.Model): domain="[('company_id', '=', company_id), ('code', '=', 'financial.contract.guarantee')]", ) amount_guarantee_limit = fields.Monetary("Plafond de garantie") + fmg_rate = fields.Float("Taux FMG") + social_share_rate = fields.Float("Taux Parts Sociales") + social_share_amount_max = fields.Float("Plafond parts sociales (€)") # ------------------------------------------------------ # Fields declaration diff --git a/models/res_config_settings.py b/models/res_config_settings.py index 9071add1ebc71fa63aacda83f3efa74407608d48..e2c540ed6f151ba5595c6cbcdc1227d07312f5f7 100644 --- a/models/res_config_settings.py +++ b/models/res_config_settings.py @@ -11,6 +11,8 @@ class ResConfigSettings(models.TransientModel): related="company_id.contract_guarantee_sequence_id", readonly=False ) amount_guarantee_limit = fields.Monetary( - related="company_id.amount_guarantee_limit", readonly=False + related="company_id.amount_guarantee_limit", readonly=False, currency_field="company_currency_id" ) - currency_id = fields.Many2one(related="company_id.currency_id") + fmg_rate = fields.Float("Taux FMG", related="company_id.fmg_rate", readonly=False) + social_share_rate = fields.Float("Taux Parts Sociales", related="company_id.social_share_rate", readonly=False) + social_share_amount_max = fields.Float("Plafond parts sociales (€)", related="company_id.social_share_amount_max", readonly=False) diff --git a/models/res_partner.py b/models/res_partner.py index 6ad8bd80ae866b4d95048bb18c1abbb4846fc538..1ba5f9cee7daa019a0edf0145cb65fcaaccfaf0b 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -27,6 +27,7 @@ class ResPartner(models.Model): is_amount_guarantee_limit = fields.Boolean( string="Plafond de garantie dépassé", compute="_compute_ongoing_guarantee" ) + guarantee_by_company = fields.Json(compute="_compute_ongoing_guarantee") # ------------------------------------------------------ # SQL Constraints @@ -47,20 +48,28 @@ class ResPartner(models.Model): def _compute_ongoing_guarantee(self): for partner in self: - guarantee_ids = partner.financial_contract_guarantee_ids.filtered( - lambda guarantee: guarantee.company_id == self.env.company - and guarantee.state == "contract" + guarantee_by_company = self.financial_contract_guarantee_ids.read_group( + domain=[("partner_id", "=", partner.id), ("state", "in", ["paid", "litigation"])], + fields=["company_id", "remaining_capital", "guarantee_amount", "final_risk_guarantee"], + groupby=["company_id"] ) - ongoing_guarantee_amount = sum(guarantee_ids.mapped("remaining_capital")) - partner.guarantee_amount_ongoing = ongoing_guarantee_amount + + partner_guarantee_amount_ongoing = 0 + for line in guarantee_by_company: + line["currency_id"] = self.env.company.currency_id.id + if line.get("company_id") and line["company_id"][0] == self.env.company.id: + partner_guarantee_amount_ongoing = line.get("guarantee_amount") + + partner.guarantee_by_company = guarantee_by_company + + partner.guarantee_amount_ongoing = partner_guarantee_amount_ongoing partner.guarantee_amount_left = ( - self.env.company.amount_guarantee_limit - ongoing_guarantee_amount - ) - partner.is_amount_guarantee_limit = ( - True - if ongoing_guarantee_amount > self.env.company.amount_guarantee_limit - else False + self.env.company.amount_guarantee_limit - partner_guarantee_amount_ongoing ) + if partner_guarantee_amount_ongoing > self.env.company.amount_guarantee_limit: + partner.is_amount_guarantee_limit = True + else: + partner.is_amount_guarantee_limit = False # ------------------------------------------------------ # Onchange / Constraints diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv index dd9292b556f93ab9bf6845a9e06a76180b12b7fc..f2106df94e06e8d38ff89e6a93d6ad07898158f3 100644 --- a/security/ir.model.access.csv +++ b/security/ir.model.access.csv @@ -1,6 +1,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_financial_contract_guarantee,access_financial_contract_guarantee,model_financial_contract_guarantee,financial_contract.group_financial_user,1,1,1,1 access_financial_contract_guarantee_line,access_financial_contract_guarantee_line,model_financial_contract_guarantee_line,financial_contract.group_financial_user,1,1,1,1 +access_financial_contract_guarantee_partner,access_financial_contract_guarantee_partner,model_financial_contract_guarantee_partner,financial_contract.group_financial_user,1,1,1,1 access_financial_product_template_guarantee,access_financial_product_template_guarantee,model_financial_product_template_guarantee,financial_contract.group_financial_user,1,0,0,0 access_financial_product_template_guarantee_admin,access_financial_product_template_guarantee,model_financial_product_template_guarantee,financial_contract.group_financial_admin,1,1,1,1 access_financial_contract_guarantee_suspensive_condition,access_financial_contract_guarantee_suspensive_condition,model_financial_contract_guarantee_suspensive_condition,financial_contract.group_financial_user,1,1,1,1 diff --git a/security/security_rules.xml b/security/security_rules.xml index b0199453007441e13f01e7f44248d175e27c093d..62bc8c5677a7e4c92673c2b5b9ed3d58b65c0288 100644 --- a/security/security_rules.xml +++ b/security/security_rules.xml @@ -19,11 +19,11 @@ <field name="perm_unlink" eval="True" /> </record> <record id="financial_contract_guarantee_multi_company_rule" model="ir.rule"> - <field name="name">Financial Contract Guarantee Multi Company</field> + <field name="name">Garantie : Multi Company</field> <field name="model_id" ref="model_financial_contract_guarantee" /> <field name="domain_force" - >[('company_id', 'in', company_ids + [False])]</field> + >[('company_id', 'in', company_ids + [False]), ('state', '!=', 'init')]</field> <field name="groups" eval="[(6, 0, [ref('financial_contract.group_financial_user')])]" diff --git a/static/src/components/guarantee_summary.js b/static/src/components/guarantee_summary.js new file mode 100644 index 0000000000000000000000000000000000000000..b30daa31a0b91cc5f87e96c61981bf7c85a0a10f --- /dev/null +++ b/static/src/components/guarantee_summary.js @@ -0,0 +1,23 @@ +import {Component} from "@odoo/owl"; +import {registry} from "@web/core/registry"; +import { standardFieldProps } from "@web/views/fields/standard_field_props"; +import { formatMonetary } from "@web/views/fields/formatters"; + +export class FinancialGuaranteeSummary extends Component { + static template = "financial_contract_guarantee.FinancialGuaranteeSummary"; + static props = { + ...standardFieldProps, + }; + + setup() { + super.setup(); + this.data = this.props.record.data[this.props.name]; + this._formatMonetary = (num, currencyId) => formatMonetary(num,{ currencyId: currencyId}); + } +} + +export const financialGuaranteeSummary = { + component: FinancialGuaranteeSummary, +} + +registry.category("fields").add("financial_guarantee_summary", financialGuaranteeSummary); diff --git a/static/src/components/guarantee_summary.xml b/static/src/components/guarantee_summary.xml new file mode 100644 index 0000000000000000000000000000000000000000..5d1d4fe0c0c0fa6a57338d1903204205939efb3e --- /dev/null +++ b/static/src/components/guarantee_summary.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<template> + + <t t-name="financial_contract_guarantee.FinancialGuaranteeSummary"> + <t t-if="!this.data"> + <p>Il n'y a pas de contrat de garantie en cours.</p> + </t> + <t t-else=""> + <table class="table table-sm table-hover table-striped"> + <thead> + <tr> + <th>Société</th> + <th class="text-end">Capital restant</th> + <th class="text-end">Montant garanti</th> + <th class="text-end">Risque final</th> + </tr> + </thead> + <tbody> + <tr t-foreach="this.data" t-as="line" t-key="line_index"> + <td t-out="line.company_id[1]"/> + <td class="text-end" t-out="_formatMonetary(line.remaining_capital, line.currency_id)" /> + <td class="text-end" t-out="_formatMonetary(line.guarantee_amount, line.currency_id)" /> + <td class="text-end" t-out="_formatMonetary(line.final_risk_guarantee, line.currency_id)" /> + </tr> + </tbody> + </table> + </t> + </t> + +</template> diff --git a/views/financial_contract_guarantee.xml b/views/financial_contract_guarantee.xml index 185539be9f4fe528842ac7b62b07f3e3243f82b7..1b1f7c71448ab333f58acab160c6b9197a061d29 100644 --- a/views/financial_contract_guarantee.xml +++ b/views/financial_contract_guarantee.xml @@ -8,19 +8,22 @@ <field name="model">financial.contract.guarantee</field> <field name="arch" type="xml"> <list> - <field name="currency_id" invisible="1" /> + <field name="currency_id" column_invisible="1" /> <field name="partner_id" /> <field name="state" /> <field name="expiration_date" /> - <field name="amount" string="Montant" /> + <field name="amount_initial" /> + <field name="guarantee_rate" widget="percentage" optional="show" /> + <field name="amount_received" /> + <field name="payment_date" optional="show" /> <field name="external_loan_id" /> - <field name="fmg_amount" /> - <field name="social_share_amount" /> - <field name="guarantee_rate" widget="percentage" /> - <field name="is_counter_guarantee" /> - <field name="final_risk_guarantee" /> - <field name="payment_date" /> - <field name="company_id" /> + <field name="guarantee_amount" optional="show" /> + <field name="final_risk_guarantee" optional="show" /> + <field name="fmg_amount" optional="show" /> + <field name="social_share_amount" optional="show" /> + <field name="is_counter_guarantee" optional="show" /> + <field name="final_risk_guarantee" optional="show" /> + <field name="company_id" optional="show" /> </list> </field> </record> @@ -47,7 +50,21 @@ <field name="guarantee_rate" widget="percentage" /> <field name="fmg_amount" /> <field name="social_share_amount" /> + <field name="social_share_number" /> <field name="is_counter_guarantee" /> + <field + name="counter_guarantee_rate" + widget="percentage" + invisible="not is_counter_guarantee" + required="is_counter_guarantee" + /> + <field + name="counter_guarantee_partner_id" + widget="percent" + invisible="not is_counter_guarantee" + options="{'no_create': 1}" + required="is_counter_guarantee" + /> </xpath> <xpath expr="//group[@name='contract_data']" position="after"> <group name="loan_data" string="Données du prêt lié"> @@ -132,6 +149,7 @@ <record model="ir.actions.act_window" id="financial_contract_guarantee_action"> <field name="name">Garanties</field> <field name="res_model">financial.contract.guarantee</field> + <field name="path">guarantee</field> <field name="view_mode">list,form,pivot,graph</field> <field name="context" diff --git a/views/financial_contract_guarantee_partner.xml b/views/financial_contract_guarantee_partner.xml new file mode 100644 index 0000000000000000000000000000000000000000..97819dd7f71e101c5ef4051424ac902f9b6a970d --- /dev/null +++ b/views/financial_contract_guarantee_partner.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" ?> +<!-- Copyright 2024 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> +<odoo> + <!-- Tree --> + <record id="financial_contract_guarantee_partner_tree_view" model="ir.ui.view"> + <field name="name">financial.contract.guarantee.partner.list</field> + <field name="model">financial.contract.guarantee.partner</field> + <field name="arch" type="xml"> + <list> + <field name="name" /> + <field name="active" readonly="1" /> + </list> + </field> + </record> + + <!-- Search --> + <record id="financial_contract_guarantee_partner_search_view" model="ir.ui.view"> + <field name="name">financial.contract.guarantee.partner.search</field> + <field name="model">financial.contract.guarantee.partner</field> + <field name="arch" type="xml"> + <search> + <field name="name" /> + <filter name="active" string="Actif" domain="[('active', '=', True)]" /> + <filter name="inactive" string="Archivé" domain="[('active', '=', False)]" /> + </search> + </field> + </record> + + <!-- Action --> + <record + model="ir.actions.act_window" + id="financial_contract_guarantee_partner_action" + > + <field name="name">Contre Garanties</field> + <field name="res_model">financial.contract.guarantee.partner</field> + <field name="path">guarantee-partner</field> + <field name="view_mode">list</field> + </record> + +</odoo> diff --git a/views/financial_product_template_guarantee.xml b/views/financial_product_template_guarantee.xml index 98ae5dd9704d8e2b7c88136a3cd8f9c761e0e114..60c4ea9ec25070bee83f68921eb1c683ed69c805 100644 --- a/views/financial_product_template_guarantee.xml +++ b/views/financial_product_template_guarantee.xml @@ -72,6 +72,7 @@ > <field name="name">Garanties</field> <field name="res_model">financial.product.template.guarantee</field> + <field name="path">guarantee-product</field> <field name="view_mode">list,form</field> </record> </odoo> diff --git a/views/menus.xml b/views/menus.xml index d3d2dfc4f4d73c862b7914859033d41844ff8594..64362c09cb01eb21326d08d8cde34e1340628054 100644 --- a/views/menus.xml +++ b/views/menus.xml @@ -21,4 +21,13 @@ action="financial_product_template_guarantee_action" sequence="40" /> + + <!-- Configuration --> + <menuitem + id="menu_financial_contract_guarantee_partner" + name="Contre Garanties" + parent="financial_contract.menu_financial_contract_configuration" + action="financial_contract_guarantee_partner_action" + sequence="60" + /> </odoo> diff --git a/views/res_config_settings.xml b/views/res_config_settings.xml index e5031161cc67e700da17665839549de0d2015687..7841bf4e9bd1fa4668d55bcf8e029d68e55f6be5 100644 --- a/views/res_config_settings.xml +++ b/views/res_config_settings.xml @@ -16,16 +16,44 @@ <field name="arch" type="xml"> <xpath expr="//app[@name='financial_contract']" position="inside"> <block title="Configuration des garanties" name="guarantee"> - <setting title="Sélection des numéros de contrat pour la garantie"> + <setting title="Numérotation"> + <label for="contract_guarantee_sequence_id" /> + <p class="text-muted">Sélectionner la séquence des numéros de contrat pour la garantie</p> <field name="contract_guarantee_sequence_id" options="{'no_create': 1}" /> </setting> - <setting - title="Montant du plafond de garantie pour cette société. Laisser à 0 si pas de plafond" - > - <field name="amount_guarantee_limit" /> + <setting title="Plafond de garantie"> + <div class="content-group"> + <div class="row"> + <label for="amount_guarantee_limit" /> + <p class="text-muted">Montant du plafond de garantie pour cette société. Laisser à 0 si pas de plafond</p> + <field name="amount_guarantee_limit" /> + </div> + <div class="row mt16"> + </div> + </div> + </setting> + <setting title="FMG" company_dependent="1"> + <div class="content-group"> + <div class="row"> + <label for="fmg_rate" /> + <field name="fmg_rate" widget="percentage"/> + </div> + </div> + </setting> + <setting title="Parts Sociales" company_dependent="1"> + <div class="content-group"> + <div class="row"> + <label for="social_share_rate" /> + <field name="social_share_rate" widget="percentage" /> + </div> + <div class="row mt16"> + <label for="social_share_amount_max" /> + <field name="social_share_amount_max" widget="monetary" /> + </div> + </div> </setting> </block> </xpath> diff --git a/views/res_partner.xml b/views/res_partner.xml index dbc6eefe7b833e21ec6557b718b1297c115efcc9..bb16010a069de363bc17470d8f1ae277e27a7f8c 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -24,14 +24,15 @@ </button> </xpath> <xpath expr="//notebook" position="inside"> - <page name="guarantee_contracts" string="Contrats de garantie"> - <group> - <group> - <field name="guarantee_amount_ongoing" /> - <field name="guarantee_amount_left" /> - </group> - </group> + <page name="guarantee_contracts" string="Garanties"> + <field name="guarantee_amount_ongoing" invisible="1" /> + <field name="guarantee_amount_left" invisible="1" /> + <separator string="En cours de garantie" /> + <field name="guarantee_by_company" class="w-100" widget="financial_guarantee_summary" /> + + <separator string="Contrats garantie" /> <field name="financial_contract_guarantee_ids" readonly="1" /> + </page> </xpath> </field>