Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
O
oacc_account
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
Opération Auto-Consommation Collective
oacc_account
Validations
bc7018db
Valider
bc7018db
rédigé
Il y a 2 mois
par
Julien - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[ADD] auto company
parent
7efd1587
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
migrations/16.0.4.0.2/post-migration.py
+0
-1
0 ajout, 1 suppression
migrations/16.0.4.0.2/post-migration.py
models/account_move.py
+12
-9
12 ajouts, 9 suppressions
models/account_move.py
models/res_partner.py
+52
-27
52 ajouts, 27 suppressions
models/res_partner.py
avec
64 ajouts
et
37 suppressions
migrations/16.0.4.0.2/post-migration.py
+
0
−
1
Voir le fichier @
bc7018db
...
...
@@ -5,7 +5,6 @@ from openupgradelib import openupgrade
@openupgrade.migrate
()
def
migrate
(
env
,
version
):
moves
=
env
[
"
account.move
"
].
search
([(
"
move_type
"
,
"
=
"
,
"
out_refund
"
)])
for
move
in
moves
:
move
.
_compute_amount_oacc
()
Ce diff est replié.
Cliquez pour l'agrandir.
models/account_move.py
+
12
−
9
Voir le fichier @
bc7018db
...
...
@@ -57,7 +57,8 @@ class AccountMove(models.Model):
)
power_cons_display
=
fields
.
Float
(
"
Electricité locale (kwh)
"
,
digits
=
"
Unité de Mesure
"
,
"
Electricité locale (kwh)
"
,
digits
=
"
Unité de Mesure
"
,
store
=
True
,
readonly
=
True
,
compute
=
"
_compute_power_cons_display
"
,
...
...
@@ -163,7 +164,7 @@ class AccountMove(models.Model):
Calcul de la quantité facturée a afficher ( négatif si facture extournée)
"""
for
move
in
self
:
if
move
.
move_type
==
'
out_refund
'
:
if
move
.
move_type
==
"
out_refund
"
:
move
.
power_cons_display
=
move
.
power_cons
*
-
1
else
:
move
.
power_cons_display
=
move
.
power_cons
...
...
@@ -173,7 +174,7 @@ class AccountMove(models.Model):
"
line_ids.price_total
"
,
"
line_ids.price_unit
"
,
"
line_ids.quantity
"
,
"
move_type
"
"
move_type
"
,
)
def
_compute_amount_oacc
(
self
):
"""
...
...
@@ -203,7 +204,7 @@ class AccountMove(models.Model):
else
:
tot_divers
+=
line
.
price_subtotal
if
move
.
move_type
==
'
out_refund
'
:
if
move
.
move_type
==
"
out_refund
"
:
move
.
amount_accise_tot
=
tot_accise
*
-
1
move
.
amount_elec_tot
=
tot_elec
*
-
1
move
.
amount_divers_tot
=
tot_divers
*
-
1
...
...
@@ -595,12 +596,14 @@ class AccountMove(models.Model):
elif
self
.
acc_operation_id
.
subscription_type
==
"
kw
"
:
quantity
=
move
.
power_cons
subscription_move_line
=
move
.
_process_create_subscription_move_line
(
subscription_move_line
=
(
move
.
_process_create_subscription_move_line
(
quantity
,
delivery_id
,
counter_start_date
,
counter_end_date
,
)
)
if
subscription_move_line
:
move_lines_to_create
.
append
(
subscription_move_line
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
models/res_partner.py
+
52
−
27
Voir le fichier @
bc7018db
...
...
@@ -54,37 +54,62 @@ class ResPartner(models.Model):
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------
def
get_linked_company_data
(
self
):
"""
Retourne un dictionnaire contenant les données de creation de la société liées
"""
company_data
=
super
().
get_linked_company_data
()
# mise en page
company_data
[
"
external_report_layout_id
"
]
=
self
.
env
.
ref
(
"
oacc_account.external_layout_oacc
"
).
id
# escompte
company_data
[
"
early_pay_discount_computation
"
]
=
"
excluded
"
# devise
company_data
[
"
currency_id
"
]
=
(
self
.
env
[
"
res.currency
"
].
search
([(
"
name
"
,
"
=
"
,
"
EUR
"
)]).
id
)
# methode d arrondi
company_data
[
"
tax_calculation_rounding_method
"
]
=
"
round_globally
"
# pays fiscal (normalement renseigné via le pays)
if
not
company_data
.
get
(
"
account_fiscal_country_id
"
):
company_data
[
"
account_fiscal_country_id
"
]
=
self
.
env
.
ref
(
"
base.fr
"
).
id
company_data
[
"
account_purchase_tax_id
"
]
=
(
self
.
env
[
"
account.tax.template
"
]
.
search
(
[
(
"
name
"
,
"
=
"
,
"
TVA 20%
"
),
(
"
type_tax_use
"
,
"
=
"
,
"
purchase
"
),
(
"
tax_scope
"
,
"
=
"
,
"
service
"
),
]
)
.
id
)
company_data
[
"
account_sale_tax_id
"
]
=
(
self
.
env
[
"
account.tax.template
"
]
.
search
(
[
(
"
name
"
,
"
=
"
,
"
TVA 20%
"
),
(
"
type_tax_use
"
,
"
=
"
,
"
sale
"
),
(
"
tax_scope
"
,
"
=
"
,
"
service
"
),
]
)
.
id
)
company_data
[
"
invoice_terms_tax
"
]
=
True
company_data
[
"
use_invoice_terms_tax
"
]
=
True
company_data
[
"
chart_template_id
"
]
=
(
self
.
env
[
"
account.chart.template
"
]
.
search
([(
"
country_id
"
,
"
=
"
,
self
.
country_code
)])
.
id
)
return
company_data
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
@api.model_create_multi
def
create
(
self
,
vals_list
):
for
vals
in
vals_list
:
# If billing agent, create a sequence
if
any
(
role
and
role
[
2
]
and
role
[
2
].
get
(
"
role
"
)
==
"
4_mand
"
for
role
in
vals
.
get
(
"
acc_operation_role_ids
"
,
[
False
,
False
,
[]])
):
vals
[
"
ref_producer
"
]
=
self
.
env
[
"
ir.sequence
"
].
next_by_code
(
"
res.partner
"
)
result
=
super
().
create
(
vals_list
)
return
result
def
write
(
self
,
vals
):
"""
Overwrite write method to initialize ref_producer if empty
"""
if
(
any
(
role
and
role
[
2
]
and
role
[
2
].
get
(
"
role
"
)
==
"
4_mand
"
for
role
in
vals
.
get
(
"
acc_operation_role_ids
"
,
[
False
,
False
,
[]])
)
and
not
self
.
ref_producer
):
vals
[
"
ref_producer
"
]
=
self
.
env
[
"
ir.sequence
"
].
next_by_code
(
"
res.partner
"
)
return
super
().
write
(
vals
)
def
_fields_sync
(
self
,
values
):
res
=
super
().
_fields_sync
(
values
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter