Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
financial_deal_contract
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Le Filament
financial_tools
financial_deal_contract
Commits
fdd57cac
Commit
fdd57cac
authored
1 year ago
by
Thibaud - Le Filament
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] Linked deal_flow_tool_type with corresponding tool (loan manager)
parent
166399e9
Branches
Branches containing commit
No related tags found
1 merge request
!1
Draft: Link deal_flow_tool_type with corresponding tool
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
__manifest__.py
+2
-5
2 additions, 5 deletions
__manifest__.py
models/financial_contract.py
+56
-1
56 additions, 1 deletion
models/financial_contract.py
views/financial_contract.xml
+2
-1
2 additions, 1 deletion
views/financial_contract.xml
with
60 additions
and
7 deletions
__manifest__.py
+
2
−
5
View file @
fdd57cac
{
{
"
name
"
:
"
Financial - Deal Contract
"
,
"
name
"
:
"
Financial - Deal Contract
"
,
"
summary
"
:
"
Du deal flow au contrat
"
,
"
summary
"
:
"
Du deal flow au contrat
"
,
"
author
"
:
"
Le Filament
"
,
"
author
"
:
"
Le Filament
, Odoo Community Association (OCA)
"
,
"
website
"
:
"
https://le-filament.com
"
,
"
website
"
:
"
https://le-filament.com
"
,
"
version
"
:
"
16.0.1.0.0
"
,
"
version
"
:
"
16.0.1.0.0
"
,
"
license
"
:
"
AGPL-3
"
,
"
license
"
:
"
AGPL-3
"
,
"
depends
"
:
[
"
depends
"
:
[
"
financial_deal_flow
"
,
"
financial_contract
"
,
"
loan_manager
"
],
"
financial_deal_flow
"
,
"
financial_contract
"
,
],
"
data
"
:
[
"
data
"
:
[
# "security/ir.model.access.csv",
# "security/ir.model.access.csv",
# datas
# datas
...
...
This diff is collapsed.
Click to expand it.
models/financial_contract.py
+
56
−
1
View file @
fdd57cac
# © 2019 Le Filament (<http://www.le-filament.com>)
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from
datetime
import
datetime
from
ocb.odoo
import
api
from
odoo
import
fields
,
models
from
odoo
import
fields
,
models
MAP_DICT
=
{
"
loan
"
:
"
loan.manager.loan
"
,
"
invest
"
:
""
,
"
warranty
"
:
""
}
class
FinancialContract
(
models
.
Model
):
class
FinancialContract
(
models
.
Model
):
_inherit
=
"
financial.contract
"
_inherit
=
"
financial.contract
"
deal_tool_id
=
fields
.
Many2one
(
deal_tool_id
=
fields
.
Many2one
(
comodel_name
=
"
financial.deal.tool
"
,
comodel_name
=
"
financial.deal.tool
"
,
string
=
"
Deal Tool
"
,
string
=
"
Deal Tool
"
,
...
@@ -18,7 +22,58 @@ class FinancialContract(models.Model):
...
@@ -18,7 +22,58 @@ class FinancialContract(models.Model):
related
=
"
deal_tool_id.deal_id
"
,
related
=
"
deal_tool_id.deal_id
"
,
store
=
True
,
store
=
True
,
)
)
deal_tool_model_id
=
fields
.
Many2one
(
"
ir.model
"
,
compute
=
"
_compute_deal_tool_model_id
"
,
store
=
True
)
deal_tool_model_id_referenced_id
=
fields
.
Integer
(
readonly
=
True
,
help
=
"
Id of the financial tool for this contract
"
)
# ------------------------------------------------------
# SQL Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# Default methods
# ------------------------------------------------------
# ------------------------------------------------------
# ------------------------------------------------------
# Computed fields / Search Fields
# Computed fields / Search Fields
# ------------------------------------------------------
# ------------------------------------------------------
@api.depends
(
"
deal_tool_id
"
)
def
_compute_deal_tool_model_id
(
self
):
if
self
.
deal_tool_id
.
type
:
self
.
deal_tool_model_id
=
self
.
env
[
"
ir.model
"
].
search
(
[(
"
model
"
,
"
=
"
,
MAP_DICT
[
self
.
deal_tool_id
.
type
])]
)
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
@api.model
def
create
(
self
,
values
):
contract
=
super
().
create
(
values
)
# Create financial tool associated
financial_tool_record
=
self
.
env
[
contract
.
deal_tool_model_id
.
model
].
create
(
{
"
description
"
:
contract
.
name
,
"
first_term_date
"
:
datetime
.
now
,
"
payment_date
"
:
datetime
.
now
,
"
amount
"
:
contract
.
deal_tool_id
.
amount
,
"
partner_id
"
:
contract
.
deal_id
.
partner_id
,
}
)
self
.
deal_tool_model_id_referenced_id
=
financial_tool_record
.
id
return
contract
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------
This diff is collapsed.
Click to expand it.
views/financial_contract.xml
+
2
−
1
View file @
fdd57cac
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
/>
/>
<field
name=
"arch"
type=
"xml"
>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//field[@name='partner_id']"
position=
"before"
>
<xpath
expr=
"//field[@name='partner_id']"
position=
"before"
>
<field
name=
"deal_id"
readonly=
"True"
/>
<field
name=
"deal_tool_id"
/>
<field
name=
"deal_tool_model_id"
/>
</xpath>
</xpath>
</field>
</field>
</record>
</record>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment