diff --git a/__manifest__.py b/__manifest__.py
index 92561749168c601fa526205d9b328d9e9a039d29..3f6ad0ab6318fbac4d9132f400da52520a305cf8 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -5,7 +5,7 @@
"website": "https://le-filament.com",
"version": "16.0.1.0.0",
"license": "AGPL-3",
- "depends": ["financial_deal_contract", "loan_manager"],
+ "depends": ["financial_deal_contract", "loan_manager", "financial_deal_flow"],
"data": [
"security/ir.model.access.csv",
# datas
diff --git a/models/__init__.py b/models/__init__.py
index 4c846b743fca0c54f721d1999586d8c3b4fe9fa7..8f24eedbdcf2ea79c23d3eb663bff4ac5de229eb 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -1 +1,6 @@
-from . import financial_manager, financial_contract, loan_manager_loan
+from . import (
+ financial_manager,
+ financial_contract,
+ loan_manager_loan,
+ financial_deal_tool,
+)
diff --git a/models/financial_contract.py b/models/financial_contract.py
index be72c7395c72e4e148a6f9805ba4c6d18b8b56f1..5f765ead38ee70735c360cde02b523c2231c2d70 100644
--- a/models/financial_contract.py
+++ b/models/financial_contract.py
@@ -76,23 +76,6 @@ class FinancialContract(models.Model):
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
- def btn_init_product(self):
- # "duration_or_count": 15,
- # "bank_account": "FR15 984 5351 864",
- creation_dict = {
- "description": self.name,
- "amount": self.deal_tool_id.amount,
- "payment_date": datetime.now(),
- "periodicity": "6",
- "rate": 1.60,
- "partner_id": self.deal_id.partner_id.id,
- "contract_id": self.id,
- }
-
- # Create financial tool associated
- financial_tool_record = self.env[self.deal_tool_model].create(creation_dict)
- self.deal_tool_model_reference_id = financial_tool_record.id
-
def btn_open_tool_form(self):
return {
"name": _("Financial tool"),
diff --git a/models/financial_deal_tool.py b/models/financial_deal_tool.py
new file mode 100644
index 0000000000000000000000000000000000000000..43b19258f2e8275c0ce1f90a6389a0151b73aa27
--- /dev/null
+++ b/models/financial_deal_tool.py
@@ -0,0 +1,63 @@
+# Copyright 2023- Le Filament (https://le-filament.com)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
+
+from odoo import models
+from datetime import datetime
+
+
+class TemplateModel(models.Model):
+ _inherit = "financial.deal.tool"
+
+ # ------------------------------------------------------
+ # Fields declaration
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # SQL Constraints
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # Default methods
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # Computed fields / Search Fields
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # Onchange / Constraints
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # CRUD methods (ORM overrides)
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # Actions
+ # ------------------------------------------------------
+
+ # ------------------------------------------------------
+ # Business methods
+ # ------------------------------------------------------
+ def generate_contract(self):
+ # FIXME A hérité de la méthode extraitre dans financial deal_contract
+ contract = super().generate_contract()
+ # Create associated tool
+
+ # "duration_or_count": 15,
+ # "bank_account": "FR15 984 5351 864",
+ creation_dict = {
+ "description": self.deal_id.description,
+ "amount": self.amount,
+ "payment_date": datetime.now(),
+ "periodicity": "6",
+ "rate": 1.60,
+ "partner_id": self.deal_id.partner_id.id,
+ "contract_id": contract.id,
+ }
+
+ # Create financial tool associated
+ financial_tool_record = self.env[contract.deal_tool_model].create(creation_dict)
+ contract.deal_tool_model_reference_id = financial_tool_record.id
+
+ return contract
diff --git a/models/loan_manager_loan.py b/models/loan_manager_loan.py
index b8578a9f51eaff18f698db6f1ce9f4ee32e94101..0a5b3674c2b2928758ada85993e75293ffd245f8 100644
--- a/models/loan_manager_loan.py
+++ b/models/loan_manager_loan.py
@@ -1,7 +1,7 @@
# Copyright 2023- Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
-from odoo import models, fields
+from odoo import fields, models
class Loan(models.Model):
diff --git a/views/financial_contract.xml b/views/financial_contract.xml
index e468dade524fb4e54ff416dcd18c3dd4d956a29e..8b4f3b3b4cdd803334326de87a6707f2df652576 100644
--- a/views/financial_contract.xml
+++ b/views/financial_contract.xml
@@ -31,16 +31,11 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="after">
<field name="deal_tool_model_reference_id" invisible="1"/>
- <button
- name="btn_init_product"
- type="object"
- icon="fa-share"
- attrs="{'invisible':[('deal_tool_model_reference_id','!=',0)]}"
- />
<button
name="btn_open_tool_form"
type="object"
icon="fa-calculator"
+ title="see tool"
attrs="{'invisible':[('deal_tool_model_reference_id','=',0)]}"
/>
</xpath>