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
d176397b
Commit
d176397b
authored
2 years ago
by
Juliana
Browse files
Options
Downloads
Patches
Plain Diff
[ADD]Add ref productor
parent
49e4a2be
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
__manifest__.py
+1
-0
1 addition, 0 deletions
__manifest__.py
data/data.xml
+15
-0
15 additions, 0 deletions
data/data.xml
models/res_partner.py
+8
-2
8 additions, 2 deletions
models/res_partner.py
views/res_partner_views.xml
+1
-0
1 addition, 0 deletions
views/res_partner_views.xml
with
25 additions
and
2 deletions
__manifest__.py
+
1
−
0
View file @
d176397b
...
...
@@ -10,6 +10,7 @@
"
security/ir.model.access.csv
"
,
# datas
"
data/mail_data.xml
"
,
"
data/data.xml
"
,
# views
"
views/res_partner_views.xml
"
,
"
views/acc_operation_views.xml
"
,
...
...
This diff is collapsed.
Click to expand it.
data/data.xml
0 → 100644
+
15
−
0
View file @
d176397b
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data
noupdate=
"1"
>
<record
id=
"sequence_prod_seq"
model=
"ir.sequence"
>
<field
name=
"name"
>
Séquence pour les producteurs
</field>
<field
name=
"code"
>
res.partner
</field>
<field
name=
"prefix"
>
P
</field>
<field
name=
"padding"
>
4
</field>
<field
eval=
"False"
name=
"company_id"
/>
</record>
</data>
</odoo>
This diff is collapsed.
Click to expand it.
models/res_partner.py
+
8
−
2
View file @
d176397b
# Copyright 2021 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
ResPartner
(
models
.
Model
):
...
...
@@ -34,6 +34,7 @@ class ResPartner(models.Model):
)
mail_contact_pmo
=
fields
.
Char
(
"
Mail du contact PMO
"
)
date_log
=
fields
.
Datetime
(
"
Date de connexion
"
)
ref_producer
=
fields
.
Char
(
"
Référence du producteur
"
)
# ------------------------------------------------------
# SQL Constraints
# ------------------------------------------------------
...
...
@@ -53,7 +54,12 @@ class ResPartner(models.Model):
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
@api.model
def
create
(
self
,
vals
):
if
vals
.
get
(
"
is_producer
"
)
==
True
:
vals
[
"
ref_producer
"
]
=
self
.
env
[
"
ir.sequence
"
].
next_by_code
(
"
res.partner
"
)
result
=
super
(
ResPartner
,
self
).
create
(
vals
)
return
result
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
views/res_partner_views.xml
+
1
−
0
View file @
d176397b
...
...
@@ -51,6 +51,7 @@
<field
name=
"arch"
type=
"xml"
>
<field
name=
"type"
position=
"before"
>
<field
name=
"is_producer"
/>
<field
name=
"ref_producer"
attrs=
"{'invisible': [('is_producer', '!=', True)]}"
/>
<field
name=
"is_consumer"
/>
<field
name=
"is_pmo"
/>
<field
...
...
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