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