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

[add] historic version bordereau v1

parent 8f5629f6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion!212.0 dev,!112.0 refactor cotiz
......@@ -5,6 +5,7 @@ from . import account_invoice
from . import res_company
from . import res_config_settings
from . import scop_bordereau_cg
from . import scop_bordereau_cg_version
from . import scop_cotisation_simulation
from . import scop_liasse_fiscale
from . import scop_cotisation_cg
......@@ -188,6 +188,13 @@ class Bordereau(models.Model):
# compute='_compute_emails'
# )
# Historique des versions
bordereau_version_ids = fields.One2many(
comodel_name='scop.bordereau.version',
inverse_name='bordereau_id',
string='Historique'
)
# ------------------------------------------------------
# Compute
# ------------------------------------------------------
......
# © 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import timedelta
from odoo import fields, models
class BordereauVersion(models.Model):
_name = 'scop.bordereau.version'
_description = 'Historique des versions des bordereaux des cotisations CG'
bordereau_id = fields.Many2one(
comodel_name='scop.bordereau',
string='Bordereau de rattachement',
required=True,
readonly=True,
ondelete='cascade')
name = fields.Char('Nom')
liasse_fiscale_id_old = fields.Many2one(
comodel_name='scop.liasse.fiscale',
string='Ancienne liasse fiscale',
ondelete='set null'
)
type_assiette = fields.Selection(
string='Ancien type d\'assiette',
selection=[('ca', 'CA'),
('va', 'VA'), ])
date = fields.Date('Date')
montant_assiette = fields.Integer(
string='Ancien montant assiette',)
company_currency_id = fields.Many2one(
related='bordereau_id.company_currency_id')
amount_total_cotiz = fields.Monetary(
string='Ancien montant cotisation',
currency_field='company_currency_id',)
state = fields.Boolean('Validée', default=False)
# ------------------------------------------------------
# Compute
# ------------------------------------------------------
# @api.depends('liasse_fiscale_id')
# @api.multi
# def _compute_values_calculation(self):
# for r in self:
# if r.liasse_fiscale_id:
# liasse = r.liasse_fiscale_id
# r.ca = liasse.revenue_cgsubv
# r.va = r.base_cotisation_cg.get_va(liasse)
# r.net_results = liasse.L2053_HN \
# if liasse.L2053_HN > 0 else liasse.L2051_DI
# r.wage_cg = liasse.wage_cg
# else:
# r.ca = r.va = r.net_results = r.wage_cg = 0
......@@ -5,3 +5,5 @@ access_scop_cotisation_cg,access_scop_cotisation_cg,model_scop_cotisation_cg,acc
admin_access_scop_cotisation_cg,admin_access_scop_cotisation_cg,model_scop_cotisation_cg,cgscop_partner.group_cg_administrator,1,1,1,1
access_scop_bordereau,access_scop_bordereau,model_scop_bordereau,account.group_account_manager,1,1,1,1
admin_access_scop_bordereau,admin_access_scop_bordereau,model_scop_bordereau,cgscop_partner.group_cg_administrator,1,1,1,1
access_scop_bordereau_version,access_scop_bordereau_version,model_scop_bordereau_version,account.group_account_manager,1,1,1,1
admin_access_scop_bordereau_version,admin_access_scop_bordereau_version,model_scop_bordereau_version,cgscop_partner.group_cg_administrator,1,1,1,1
......@@ -69,14 +69,15 @@
</group>
<group>
<span class="oe_grey" attrs="{'invisible': [('liasse_fiscale_id', '!=', False)]}">Pas de liasse fiscale pour le calcul</span>
<field name="liasse_fiscale_id" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<field name="year_liasse" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<field name="type_liasse_fiscale" options="{'no_open': True}" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<button name="action_change_liasse"
class="btn-info mb5"
string="Changer de liasse fiscale"
type="object"
states="new"/>
<field name="liasse_fiscale_id" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<field name="year_liasse" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<field name="type_liasse_fiscale" options="{'no_open': True}" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<br/>
<hr/>
<field name="type_assiette" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
<field name="montant_assiette" attrs="{'invisible': [('liasse_fiscale_id', '=', False)]}"/>
......@@ -112,6 +113,18 @@
</form>
</field>
</page>
<page string="Historique">
<field name="bordereau_version_ids" widget="one2many" class="mt-2">
<tree edit="false" create="false" delete="false" default_order="date desc">
<field name="date"/>
<field name="liasse_fiscale_id_old"/>
<field name="type_assiette"/>
<field name="montant_assiette"/>
<field name="amount_total_cotiz"/>
<field name="state" widget="boolean_toggle"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
......
......@@ -190,6 +190,15 @@ class ScopCotisationRegul(models.TransientModel):
'price_unit': refund_amount
})
self.env['scop.bordereau.version'].create({
'bordereau_id': bordereau_id.id,
'date': self.date_regul,
'name': bordereau_id.name[0:10],
'liasse_fiscale_id_old': bordereau_id.liasse_fiscale_id,
'type_assiette': bordereau_id.type_assiette,
'montant_assiette': bordereau_id.montant_assiette,
'amount_total_cotiz': bordereau_id.amount_total_cotiz,
})
bordereau_id.update({
'name': bordereau_id.name[0:10] + '-' + str(bordereau_id.version + 1),
'version': bordereau_id.version + 1,
......
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