diff --git a/models/scop_cotisations_idf.py b/models/scop_cotisations_idf.py index 64c0df55e41b5e1177dd815ecca1cb5f2368d993..7538fb05ae4fbbb91265c242bfe39f6db6c94c0d 100644 --- a/models/scop_cotisations_idf.py +++ b/models/scop_cotisations_idf.py @@ -32,12 +32,16 @@ class ScopCotisationsIDF(models.Model): ('pay', 'Paiment')], string='Type', ) lettrage = fields.Char('Lettrage') - debit = fields.Float(string='Débit') - credit = fields.Float(string='Crédit') - amount_residual = fields.Float( + currency_id = fields.Many2one( + comodel_name='res.currency', + string='Monnaie', + related='company_id.currency_id') + debit = fields.Monetary(string='Débit', currency_field='currency_id') + credit = fields.Monetary(string='Crédit', currency_field='currency_id') + amount_residual = fields.Monetary( string='Reste à payer', compute='_compute_amount_residual', - store=True) + store=True, currency_field='currency_id') state = fields.Selection( string='Etat', selection=[('no_invoice', 'Pas de cotisation associée'), @@ -59,14 +63,19 @@ class ScopCotisationsIDF(models.Model): required=False, readonly=True) exoneration = fields.Boolean( - string='Exoneration', + string='Exonération', compute='_compute_exoneration', store=True) - cotiz_zero = fields.Boolean(string='Non appelé') + cotiz_zero = fields.Boolean(string='Non appelée') # ------------------------------------------------------ # Computed fields # ------------------------------------------------------ + # @api.multi + # def _compute_currency(self): + # for r in self: + # r.currency_id = r.env + @api.depends('payment_or_refund_ids', 'debit', 'payment_or_refund_ids.debit', 'payment_or_refund_ids.debit') @api.multi diff --git a/models/scop_invoice_idf.py b/models/scop_invoice_idf.py index 132956e79e01d9e03de83dda81b8a64613690960..b8b51a9e122d19ad2d574b16477d4aad39a81ef2 100644 --- a/models/scop_invoice_idf.py +++ b/models/scop_invoice_idf.py @@ -32,12 +32,16 @@ class ScopinvoiceIDF(models.Model): ('pay', 'Paiment')], string='Type',) lettrage = fields.Char('Lettrage') - debit = fields.Float(string='Débit') - credit = fields.Float(string='Crédit') + currency_id = fields.Many2one( + comodel_name='res.currency', + string='Monnaie', + related='company_id.currency_id') + debit = fields.Monetary(string='Débit', currency_field='currency_id') + credit = fields.Monetary(string='Crédit', currency_field='currency_id') amount_residual = fields.Float( string='Reste à payer', compute='_compute_amount_residual', - store=True + store=True, currency_field='currency_id' ) state = fields.Selection( string='Etat', diff --git a/views/scop_cotisations_idf.xml b/views/scop_cotisations_idf.xml index 3be63e2e5ec2c7bf1e46e543f69488b67a2c1e8f..e1d8c325aac6757bb756a60d90619cab4676a4de 100644 --- a/views/scop_cotisations_idf.xml +++ b/views/scop_cotisations_idf.xml @@ -31,9 +31,10 @@ <field name="partner_id"/> <field name="year"/> <field name="type"/> - <field name="debit"/> - <field name="credit"/> - <field name='amount_residual'/> + <field name="currency_id" invisible="1"/> + <field name="debit" widget="monetary"/> + <field name="credit" widget="monetary"/> + <field name='amount_residual' widget="monetary"/> <field name='invoice_id'/> <field name='payment_or_refund_ids'/> <field name='lettrage'/> @@ -69,9 +70,10 @@ <group name="cotiz" string="Cotisation"> <field name="type"/> <field name="name"/> - <field name="credit" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/> - <field name="debit" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/> - <field name="amount_residual" + <field name="currency_id" invisible="1"/> + <field name="credit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/> + <field name="debit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/> + <field name="amount_residual" widget="monetary" attrs="{'invisible': [('type', '!=', 'inv')]}"/> <field name="invoice_id" domain="[('partner_id', '=', partner_id), ('type', '=', 'inv'), ('amount_residual', '>', 0)]" @@ -90,7 +92,8 @@ <field name="name"/> <field name="year"/> <field name="type"/> - <field name="credit" string="Montant"/> + <field name="currency_id" invisible="1"/> + <field name="credit" widget="monetary" string="Montant"/> <field name='lettrage'/> <field name='exoneration'/> <button name="action_open_payment" type="object" @@ -127,7 +130,8 @@ <field name="arch" type="xml"> <pivot string="Cotisations IDF" display_quantity="True"> <field name="partner_id" type="row"/> - <field name="amount_residual" type="measure"/> + <field name="currency_id" invisible="1"/> + <field name="amount_residual" type="measure" widget="monetary"/> </pivot> </field> </record> @@ -142,10 +146,13 @@ <field name="partner_id"/> <filter name="with_issue" domain="[('state','in',['no_invoice', 'overpaid'])]" string="Erreur lettrage et/ou montant"/> <separator/> - <filter name="is_type_invoice" domain="[('type','=','inv')]" string="Factures"/> - <filter name="inv_paid" domain="[('type','=','inv'),('state','=','paid')]" string="Factures payées"/> - <filter name="inv_unpaid" domain="[('type','=','inv'),('state','=','awaiting_payments')]" string="Factures reste à payées"/> - <filter name="inv_with_issue" domain="[('type','=','inv'),('state','=','overpaid')]" string="Factures en erreur"/> + <filter name="is_type_invoice" domain="[('type','=','inv')]" string="Cotisations"/> + <filter name="cotiz_paid" domain="[('type','=','inv'),('state','=','paid')]" string="Cotisations payées"/> + <filter name="cotiz_unpaid" domain="[('type','=','inv'),('state','=','awaiting_payments')]" string="Cotisations reste à payées"/> + <filter name="cotiz_with_issue" domain="[('type','=','inv'),('state','=','overpaid')]" string="Cotisations en erreur"/> + <separator/> + <filter name="cotiz_exo" domain="[('exoneration','=',True)]" string="Exonérations"/> + <filter name="cotiz_not_called" domain="[('type','=','inv'),('cotiz_zero','=',True)]" string="Cotisations non appelées"/> <group expand="0" string="Group By"> <filter name="group_by_partner_id" string="Adhérent" context="{'group_by':'partner_id'}"/> <separator/> diff --git a/views/scop_invoice_idf.xml b/views/scop_invoice_idf.xml index ab5833699e6feb04d5b305afbbd8533832dd1ef2..2074f36125ad732a35bb289b4ec1bd1136e6c57e 100644 --- a/views/scop_invoice_idf.xml +++ b/views/scop_invoice_idf.xml @@ -31,9 +31,10 @@ <field name="partner_id"/> <field name="year"/> <field name="type"/> - <field name="credit"/> - <field name="debit"/> - <field name='amount_residual'/> + <field name="currency_id" invisible="1"/> + <field name="credit" widget="monetary"/> + <field name="debit" widget="monetary"/> + <field name='amount_residual' widget="monetary"/> <field name='invoice_id'/> <field name='payment_or_refund_ids'/> <field name='lettrage'/> @@ -65,9 +66,10 @@ <group name="invoice" string="Facture"> <field name="type"/> <field name="name"/> - <field name="credit" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/> - <field name="debit" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/> - <field name="amount_residual" + <field name="currency_id" invisible="1"/> + <field name="credit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/> + <field name="debit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/> + <field name="amount_residual" widget="monetary" attrs="{'invisible': [('type', '!=', 'inv')]}"/> <field name="invoice_id" domain="[('partner_id', '=', partner_id), ('type', '=', 'inv'), ('amount_residual', '>', 0)]" @@ -86,7 +88,8 @@ <field name="name"/> <field name="year"/> <field name="type"/> - <field name="credit" string="Montant"/> + <field name="currency_id" invisible="1"/> + <field name="credit" string="Montant" widget="monetary"/> <field name='lettrage'/> <button name="action_open_payment" type="object" string="Paiement / Avoir" icon="fa-eye"