Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
C
cgscop_cotisation
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
Déploiement
Registre de paquets
Opération
Modules Terraform
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
Hervé Silvant - CGScop
cgscop_cotisation
Validations
8ba66ab2
Valider
8ba66ab2
rédigé
Il y a 3 ans
par
jordan
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[update] refactor payment_term to be used by ur_aura
parent
2a825db4
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
models/account_invoice.py
+9
-115
9 ajouts, 115 suppressions
models/account_invoice.py
models/account_payment_term.py
+2
-45
2 ajouts, 45 suppressions
models/account_payment_term.py
models/res_config_settings.py
+1
-1
1 ajout, 1 suppression
models/res_config_settings.py
avec
12 ajouts
et
161 suppressions
models/account_invoice.py
+
9
−
115
Voir le fichier @
8ba66ab2
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
from
datetime
import
datetime
from
datetime
import
datetime
import
json
import
json
from
odoo
import
models
,
fields
,
api
,
_
from
odoo
import
models
,
fields
,
api
from
odoo.exceptions
import
UserError
class
ScopAccountInvoice
(
models
.
Model
):
class
ScopAccountInvoice
(
models
.
Model
):
...
@@ -76,122 +75,17 @@ class ScopAccountInvoice(models.Model):
...
@@ -76,122 +75,17 @@ class ScopAccountInvoice(models.Model):
# ------------------------------------------------------
# ------------------------------------------------------
# Override Parent
# Override Parent
# ------------------------------------------------------
# ------------------------------------------------------
@api.multi
def
action_invoice_open
(
self
):
"""
Création d
'
une ligne dans scop.contribution
quand une facture cotisation devient valide
"""
results
=
super
(
ScopAccountInvoice
,
self
).
action_invoice_open
()
# for inv in self:
# if inv.is_contribution:
# inv.set_scop_contribution()
return
results
# @api.multi
# @api.multi
# def action_
move_create
(self):
# def action_
invoice_open
(self):
# """
# """
# Complete override parent
# Création d'une ligne dans scop.contribution
# Pass invoice in payment_term.compute function to generate payment
# quand une facture cotisation devient valide
# schedule
# :return: True
# """
# """
# account_move = self.env['account.move']
# results = super(ScopAccountInvoice, self).action_invoice_open()
#
# # for inv in self:
# for inv in self:
# # if inv.is_contribution:
# if not inv.journal_id.sequence_id:
# # inv.set_scop_contribution()
# raise UserError(_('Please define sequence on the journal related to this invoice.'))
# return results
# if not inv.invoice_line_ids.filtered(lambda line: line.account_id):
# raise UserError(_('Please add at least one invoice line.'))
# if inv.move_id:
# continue
#
# if not inv.date_invoice:
# inv.write({'date_invoice': fields.Date.context_today(self)})
# if not inv.date_due:
# inv.write({'date_due': inv.date_invoice})
# company_currency = inv.company_id.currency_id
#
# # create move lines
# # (one per invoice line + eventual taxes and analytic lines)
# iml = inv.invoice_line_move_line_get()
# iml += inv.tax_line_move_line_get()
#
# diff_currency = inv.currency_id != company_currency
# # create one move line for the total and possibly adjust
# # the other lines amount
# total, total_currency, iml = inv.compute_invoice_totals(
# company_currency, iml)
#
# name = inv.name or ''
# if inv.payment_term_id:
# totlines = inv.payment_term_id.with_context(
# currency_id=company_currency.id).compute(total, inv.date_invoice, inv)[0]
# res_amount_currency = total_currency
# for i, t in enumerate(totlines):
# if inv.currency_id != company_currency:
# amount_currency = company_currency._convert(
# t[1],
# inv.currency_id,
# inv.company_id,
# inv._get_currency_rate_date() or fields.Date.today())
# else:
# amount_currency = False
#
# # last line: add the diff
# res_amount_currency -= amount_currency or 0
# if i + 1 == len(totlines):
# amount_currency += res_amount_currency
#
# iml.append({
# 'type': 'dest',
# 'name': name,
# 'price': t[1],
# 'account_id': inv.account_id.id,
# 'date_maturity': t[0],
# 'amount_currency': diff_currency and amount_currency,
# 'currency_id': diff_currency and inv.currency_id.id,
# 'invoice_id': inv.id
# })
# else:
# iml.append({
# 'type': 'dest',
# 'name': name,
# 'price': total,
# 'account_id': inv.account_id.id,
# 'date_maturity': inv.date_due,
# 'amount_currency': diff_currency and total_currency,
# 'currency_id': diff_currency and inv.currency_id.id,
# 'invoice_id': inv.id
# })
# part = self.env['res.partner']._find_accounting_partner(
# inv.partner_id)
# line = [(0, 0, self.line_get_convert(l, part.id)) for l in iml]
# line = inv.group_lines(iml, line)
#
# line = inv.finalize_invoice_move_lines(line)
#
# date = inv.date or inv.date_invoice
# move_vals = {
# 'ref': inv.reference,
# 'line_ids': line,
# 'journal_id': inv.journal_id.id,
# 'date': date,
# 'narration': inv.comment,
# }
# move = account_move.create(move_vals)
# # Pass invoice in method post: used if you want to get the same
# # account move reference when creating the same invoice
# # after a cancelled one:
# move.post(invoice = inv)
# # make the invoice point to that move
# vals = {
# 'move_id': move.id,
# 'date': date,
# 'move_name': move.name,
# }
# inv.write(vals)
# return True
@api.one
@api.one
def
_get_outstanding_info_JSON
(
self
):
def
_get_outstanding_info_JSON
(
self
):
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
models/account_payment_term.py
+
2
−
45
Voir le fichier @
8ba66ab2
# Copyright 2020 Le Filament
# Copyright 2020 Le Filament
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from
odoo
import
fields
,
models
,
api
from
odoo
import
fields
,
models
class
AccountPaymentTerm
(
models
.
Model
):
class
AccountPaymentTerm
(
models
.
Model
):
_inherit
=
'
account.payment.term
'
_inherit
=
'
account.payment.term
'
is_contribution
=
fields
.
Boolean
(
'
Conditions de paiement des cotisations
'
)
is_contribution
=
fields
.
Boolean
(
'
Conditions de paiement des cotisations
'
)
\ No newline at end of file
# def compute(self, value, date_ref=False, invoice=False):
# """
# Override la fonction compute du modèle account.payment.term
# La fonction initiale checke les conditions de paiement et crée
# les lignes de paiement associées
#
# L'héritage permet de créer un échéancier en fonction de celui
# défini sur la base de cotisations
# """
# date_ref = date_ref or fields.Date.today()
# amount = value
# sign = value < 0 and -1 or 1
# if self.env.context.get('currency_id'):
# currency = self.env['res.currency'].browse(
# self.env.context['currency_id'])
# else:
# currency = self.env.user.company_id.currency_id
#
# # si base de cotisation
# if self.is_contribution and invoice and (invoice.cotisation_cg_id or invoice.cotisation_aura_id):
# result = []
# if invoice.cotisation_cg_id:
# base_contrib_field = 'cotisation_cg_id'
# elif invoice.cotisation_aura_id:
# base_contrib_field = 'cotisation_aura_id'
# trimesters = {
# 4: invoice[base_contrib_field].trimester_1,
# 3: invoice[base_contrib_field].trimester_2,
# 2: invoice[base_contrib_field].trimester_3,
# 1: invoice[base_contrib_field].trimester_4,
# }
# for i in range(invoice.nb_quarter, 0, -1):
# # Gestion de l'arrondi de la division
# if i == 1:
# amt = currency.round(amount)
# else:
# amt = currency.round(value / invoice.nb_quarter)
# result.append((fields.Date.to_string(trimesters.get(i)), amt))
# amount -= amt
# return [result]
# else:
# return super(AccountPaymentTerm, self).compute(value, date_ref)
Ce diff est replié.
Cliquez pour l'agrandir.
models/res_config_settings.py
+
1
−
1
Voir le fichier @
8ba66ab2
# © 2020 Le Filament (<http://www.le-filament.com>)
# © 2020 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
odoo
import
fields
,
models
,
api
from
odoo
import
fields
,
models
class
CotisationsConfigSettings
(
models
.
TransientModel
):
class
CotisationsConfigSettings
(
models
.
TransientModel
):
...
...
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