Skip to content
Extraits de code Groupes Projets
Valider 3b6b4154 rédigé par jordan's avatar jordan
Parcourir les fichiers

[fix] rename cotisation without final 's' and look_for_lettrage into reconcile

parent c43b73b7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -16,7 +16,7 @@
"security/ir.model.access.csv",
"views/scop_invoice_idf.xml",
"views/scop_invoice_idf_logs.xml",
"views/scop_cotisations_idf.xml",
"views/scop_cotisation_idf.xml",
"views/res_config_settings.xml",
"templates/scop_invoice_idf_header_template.xml",
"wizard/scop_invoice_idf_wizard.xml",
......
......@@ -14,8 +14,8 @@ class BannerScopInvoiceIDFController(http.Controller):
'cgscop_invoice_idf.header_template').render({})
}
@http.route(['/cgscop_cotisations_idf/header'], type="json", auth="user")
def scop_cotisations_idf_header(self):
@http.route(['/cgscop_cotisation_idf/header'], type="json", auth="user")
def scop_cotisation_idf_header(self):
return {
'html': request.env.ref(
'cgscop_invoice_idf.header_template_cotisations').render({})
......
......@@ -4,5 +4,5 @@
from . import res_company
from . import res_config_settings
from . import scop_invoice_idf
from . import scop_cotisations_idf
from . import scop_cotisation_idf
from . import scop_invoice_idf_logs
......@@ -5,7 +5,7 @@ from odoo import models, fields, api
class ScopCotisationsIDF(models.Model):
_name = "scop.cotisations.idf"
_name = "scop.cotisation.idf"
_description = "Cotisations IDF"
# ------------------------------------------------------
......@@ -54,10 +54,10 @@ class ScopCotisationsIDF(models.Model):
compute='_compute_state')
invoice_id = fields.Many2one(
comodel_name='scop.cotisations.idf',
comodel_name='scop.cotisation.idf',
string='Cotisation')
payments_ids = fields.One2many(
comodel_name='scop.cotisations.idf',
comodel_name='scop.cotisation.idf',
inverse_name='invoice_id',
string='Paiments / Avoirs',
required=False, readonly=True)
......@@ -140,7 +140,7 @@ class ScopCotisationsIDF(models.Model):
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
def look_for_lettrage(self):
def reconcile(self):
"""
Link payments and invoices if same letter for a given year
:return:
......@@ -169,11 +169,11 @@ class ScopCotisationsIDF(models.Model):
'name': 'Paiement / Avoir',
'views': [
[self.env.ref(
'cgscop_invoice_idf.view_scop_cotisations_idf_form').id,
'cgscop_invoice_idf.view_scop_cotisation_idf_form').id,
"form"]
],
'view_mode': 'form',
'res_model': 'scop.cotisations.idf',
'res_model': 'scop.cotisation.idf',
'target': 'current',
'res_id': self.id
}
......@@ -183,9 +183,9 @@ class ScopCotisationsIDF(models.Model):
def action_show_payments(self):
form_view = self.env.ref(
'cgscop_invoice_idf.view_scop_cotisations_idf_form').id
'cgscop_invoice_idf.view_scop_cotisation_idf_form').id
tree_view = self.env.ref(
'cgscop_invoice_idf.view_scop_cotisations_idf_tree').id
'cgscop_invoice_idf.view_scop_cotisation_idf_tree').id
return {
'type': 'ir.actions.act_window',
'name': 'Paiement / Avoir',
......@@ -193,14 +193,14 @@ class ScopCotisationsIDF(models.Model):
[tree_view, "tree"], [form_view, "form"]
],
'view_mode': 'form',
'res_model': 'scop.cotisations.idf',
'res_model': 'scop.cotisation.idf',
'target': 'current',
'domain': [('id', 'in', self.payments_ids.ids)]
}
def action_show_invoice(self):
form_view = self.env.ref(
'cgscop_invoice_idf.view_scop_cotisations_idf_form').id
'cgscop_invoice_idf.view_scop_cotisation_idf_form').id
return {
'type': 'ir.actions.act_window',
'name': 'Cotisation',
......@@ -208,7 +208,7 @@ class ScopCotisationsIDF(models.Model):
[form_view, "form"]
],
'view_mode': 'form',
'res_model': 'scop.cotisations.idf',
'res_model': 'scop.cotisation.idf',
'target': 'current',
'res_id': self.invoice_id.id
}
......@@ -123,7 +123,7 @@ class ScopInvoiceIDF(models.Model):
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
def look_for_lettrage(self):
def reconcile(self):
"""
Link payments and invoices if same letter for a given year
:return:
......
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_scop_invoice_idf,access_scop_invoice_idf,model_scop_invoice_idf,base.group_user,1,1,1,1
access_scop_cotisations_idf,access_scop_cotisations_idf,model_scop_cotisations_idf,base.group_user,1,1,1,1
access_scop_cotisation_idf,access_scop_cotisation_idf,model_scop_cotisation_idf,base.group_user,1,1,1,1
access_scop_invoice_idf_logs,access_scop_invoice_idf_logs,model_scop_invoice_idf_logs,base.group_user,1,1,1,1
......@@ -22,14 +22,14 @@
</div>
</template>
<template id="header_template_cotisations" name="cgscop_cotisations_idf.header_template">
<template id="header_template_cotisations" name="cgscop_cotisation_idf.header_template">
<div id="lm" style="background-color: #fff; padding: 16px 0">
<div class="container">
<div class="row">
<div class="col-12">
<span style="font-size: 1.4rem; margin-right: 32px;"><strong>Importer : </strong></span>
<a type="action"
data-method="scop_cotisations_idf_wizard_action"
data-method="scop_cotisation_idf_wizard_action"
data-model="scop.invoice.idf.wizard"
class="btn btn-secondary" style="margin-right: 32px;">
<u>Cotisations</u>
......
......@@ -3,25 +3,25 @@
<data>
<!-- Ajoute l'action "Lettrage" dans le menu du modèle -->
<record id="action_server_scop_cotisations_idf" model="ir.actions.server">
<record id="action_server_scop_cotisation_idf" model="ir.actions.server">
<field name="name">Lettrage</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_scop_cotisations_idf"/>
<field name="binding_model_id" ref="model_scop_cotisations_idf"/>
<field name="model_id" ref="model_scop_cotisation_idf"/>
<field name="binding_model_id" ref="model_scop_cotisation_idf"/>
<field name="state">code</field>
<field name="code">
if records:
action = records.look_for_lettrage()
action = records.reconcile()
</field>
</record>
<!-- TREE VIEW -->
<record model="ir.ui.view" id="view_scop_cotisations_idf_tree">
<field name="name">scop.cotisations.idf.tree</field>
<field name="model">scop.cotisations.idf</field>
<record model="ir.ui.view" id="view_scop_cotisation_idf_tree">
<field name="name">scop.cotisation.idf.tree</field>
<field name="model">scop.cotisation.idf</field>
<field name="arch" type="xml">
<tree string="Cotisations IDF"
banner_route="/cgscop_cotisations_idf/header"
banner_route="/cgscop_cotisation_idf/header"
decoration-danger="state in ['no_invoice', 'overpaid']"
decoration-info="state == 'awaiting_payments'"
import='False' default_order='writing_date desc'>
......@@ -45,17 +45,17 @@
</record>
<!-- FORM -->
<record id="view_scop_cotisations_idf_form" model="ir.ui.view">
<field name="name">scop.cotisations.idf.form</field>
<field name="model">scop.cotisations.idf</field>
<record id="view_scop_cotisation_idf_form" model="ir.ui.view">
<field name="name">scop.cotisation.idf.form</field>
<field name="model">scop.cotisation.idf</field>
<field name="arch" type="xml">
<form string="Cotisations IDF">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_show_payments" type="object" class="oe_stat_button" icon="fa-eur"
attrs="{'invisible': [('type', '!=', 'inv')]}">Paiments</button>
attrs="{'invisible': ['|', ('type', '!=', 'inv'), ('payments_ids', '=', False)]}">Paiments</button>
<button name="action_show_invoice" type="object" class="oe_stat_button" icon="fa-calculator"
attrs="{'invisible': [('type', '=', 'inv')]}">Cotisation</button>
attrs="{'invisible': ['|', ('type', '=', 'inv'), ('invoice_id', '=', False)]}">Cotisation</button>
</div>
<div class="oe_title">
<h1>
......@@ -122,9 +122,9 @@
</record>
<!-- GRAPH -->
<record id="view_scop_cotisations_idf_graph" model="ir.ui.view">
<field name="name">scop.cotisations.idf.graph</field>
<field name="model">scop.cotisations.idf</field>
<record id="view_scop_cotisation_idf_graph" model="ir.ui.view">
<field name="name">scop.cotisation.idf.graph</field>
<field name="model">scop.cotisation.idf</field>
<field name="arch" type="xml">
<graph string="Cotisations IDF">
<field name="year" type="row"/>
......@@ -134,9 +134,9 @@
</record>
<!-- PIVOT -->
<record id="view_scop_cotisations_idf_pivot" model="ir.ui.view">
<field name="name">scop.cotisations.idf.pivot</field>
<field name="model">scop.cotisations.idf</field>
<record id="view_scop_cotisation_idf_pivot" model="ir.ui.view">
<field name="name">scop.cotisation.idf.pivot</field>
<field name="model">scop.cotisation.idf</field>
<field name="arch" type="xml">
<pivot string="Cotisations IDF" display_quantity="True">
<field name="partner_id" type="row"/>
......@@ -147,9 +147,9 @@
</record>
<!-- SEARCH -->
<record id="view_scop_cotisations_idf_search" model="ir.ui.view">
<field name="name">scop.cotisations.idf.search</field>
<field name="model">scop.cotisations.idf</field>
<record id="view_scop_cotisation_idf_search" model="ir.ui.view">
<field name="name">scop.cotisation.idf.search</field>
<field name="model">scop.cotisation.idf</field>
<field name="arch" type="xml">
<search string="Paiements IDF">
<field name="partner_id"/>
......@@ -175,9 +175,9 @@
</record>
<!-- ACTION -->
<record id="action_scop_cotisations_idf" model="ir.actions.act_window">
<record id="action_scop_cotisation_idf" model="ir.actions.act_window">
<field name="name">Cotisations IDF</field>
<field name="res_model">scop.cotisations.idf</field>
<field name="res_model">scop.cotisation.idf</field>
<field name="view_mode">tree,form,pivot,graph</field>
</record>
......@@ -186,7 +186,7 @@
name="Cotisations"
parent="menu_scop_invoice_idf"
sequence="20"
action="action_scop_cotisations_idf"/>
action="action_scop_cotisation_idf"/>
</data>
</odoo>
......@@ -11,7 +11,7 @@
<field name="state">code</field>
<field name="code">
if records:
action = records.look_for_lettrage()
action = records.reconcile()
</field>
</record>
......@@ -51,9 +51,9 @@
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_show_payments" type="object" class="oe_stat_button" icon="fa-eur"
attrs="{'invisible': [('type', '!=', 'inv')]}">Paiments</button>
attrs="{'invisible': ['|', ('type', '!=', 'inv'), ('payments_ids', '=', False)]}">Paiments</button>
<button name="action_show_invoice" type="object" class="oe_stat_button" icon="fa-calculator"
attrs="{'invisible': [('type', '=', 'inv')]}">Facture</button>
attrs="{'invisible': ['|', ('type', '=', 'inv'), ('invoice_id', '=', False)]}">Facture</button>
</div>
<div class="oe_title">
<h1>
......
......@@ -48,7 +48,7 @@ class ScopImportIDFWizard(models.TransientModel):
}
@api.model
def scop_cotisations_idf_wizard_action(self):
def scop_cotisation_idf_wizard_action(self):
return {
'type': 'ir.actions.act_window',
'name': 'Import Cotisations',
......@@ -93,7 +93,7 @@ class ScopImportIDFWizard(models.TransientModel):
if self.type == 'inv':
model = 'scop.invoice.idf'
else:
model = 'scop.cotisations.idf'
model = 'scop.cotisation.idf'
for row in reader:
line += 1
......@@ -170,7 +170,7 @@ class ScopImportIDFWizard(models.TransientModel):
# Lettrage for all line in updated years
recordset_for_lettrage = self.env[model].search([
['year', 'in', list(new_lines_years)]])
recordset_for_lettrage.look_for_lettrage()
recordset_for_lettrage.reconcile()
return {
'type': 'ir.actions.act_window',
'views': [[False, "form"]],
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter