Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
acc_operation
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
Opération Auto-Consommation Collective
acc_operation
Commits
256a3cf7
Commit
256a3cf7
authored
2 years ago
by
Juliana
Browse files
Options
Downloads
Patches
Plain Diff
[ADD]Add mail after save new document
parent
4aa86bdc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
__manifest__.py
+1
-0
1 addition, 0 deletions
__manifest__.py
data/mail_data.xml
+25
-0
25 additions, 0 deletions
data/mail_data.xml
models/acc_contract.py
+15
-1
15 additions, 1 deletion
models/acc_contract.py
with
41 additions
and
1 deletion
__manifest__.py
+
1
−
0
View file @
256a3cf7
...
...
@@ -10,6 +10,7 @@
"
security/security.xml
"
,
"
security/ir.model.access.csv
"
,
# datas
"
data/mail_data.xml
"
,
# views
"
views/res_partner_views.xml
"
,
"
views/acc_operation_views.xml
"
,
...
...
This diff is collapsed.
Click to expand it.
data/mail_data.xml
0 → 100644
+
25
−
0
View file @
256a3cf7
<?xml version="1.0" ?>
<odoo>
<data
>
<!--Email template New document-->
<record
id=
"email_template_document"
model=
"mail.template"
>
<field
name=
"name"
>
ACC: Dépôt d'un nouveau document
</field>
<field
name=
"model_id"
ref=
"acc_operation.model_res_partner"
/>
<field
name=
"email_from"
>
"contact@locoop.fr"
</field>
<field
name=
"email_to"
>
${object.email_formatted | safe}
</field>
<field
name=
"subject"
>
ELOCOOP - Dépôt d'un nouveau document
</field>
<field
name=
"body_html"
type=
"html"
>
<div
style=
"margin: 0px; padding: 0px;"
>
<p
style=
"margin: 0px; padding: 0px; font-size: 13px;"
>
Bonjour,
<br/><br/>
Un nouveau document a été déposé sur votre plateforme Elocoop. Rendez-vous sur
<a
href=
"https://app.elo.coop/"
>
https://app.elo.coop/
</a>
.
<br/><br/>
Bonne journée,
<br/><br/>
L’équipe d’Elocoop
</p>
</div>
</field>
<field
name=
"auto_delete"
eval=
"False"
/>
</record>
</data>
</odoo>
This diff is collapsed.
Click to expand it.
models/acc_contract.py
+
15
−
1
View file @
256a3cf7
# Copyright 2022 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
from
odoo
import
fields
,
models
,
api
class
AccContract
(
models
.
Model
):
...
...
@@ -47,7 +47,21 @@ class AccContract(models.Model):
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
@api.model_create_multi
def
create
(
self
,
vals_list
):
doc
=
super
(
AccContract
,
self
).
create
(
vals_list
)
if
doc
.
seller_id
:
template
=
self
.
env
.
ref
(
'
acc_operation.email_template_document
'
,
raise_if_not_found
=
False
)
template
.
with_context
().
send_mail
(
doc
.
seller_id
.
id
)
if
doc
.
buyer_id
:
template
=
self
.
env
.
ref
(
'
acc_operation.email_template_document
'
,
raise_if_not_found
=
False
)
template
.
with_context
().
send_mail
(
doc
.
buyer_id
.
id
)
return
doc
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
...
...
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