Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 7b548f5463ed784d7b2ba798b8b5b50f08743589
  • 12.0-evo-202003 par défaut
  • 14-RV-20250324
  • 14-RV-20240830
  • 14-RV-20231222
  • 12-RV-Bug_ecrasement_date_radiation
  • 12-RV-revision-staff
  • 12-RV-copadev
  • 12-RV-Correctif-open-instagram
  • 12-RV-Tree-Coop-Ajout-effectif
  • 12.0-RV-Instagram
  • 12.0-RV-segment_visibility
  • 12.0 protégée
  • 12.0-RV-Abonnements
14 résultats

scop_partner_staff.py

Blame
  • Bifurcation depuis Le Filament / Confédération Générale des SCOP / cgscop_partner
    Le projet source a une visibilité limitée.
    account_payment_order.py 2,63 Kio
    # Copyright 2020 Le Filament
    # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
    
    from odoo import fields, models, api
    
    
    class AccountPaymentOrder(models.Model):
        _inherit = 'account.payment.order'
    
        payment_line_amount = fields.Float(
            string='Total Opérations',
            compute='_compute_payment_line_amount'
        )
        bank_line_amount = fields.Float(
            string='Total Lignes de paiement',
            compute='_compute_bank_line_amount'
        )
        attachment_ids = fields.One2many(
            comodel_name='ir.attachment',
            compute='_compute_attachment_ids'
        )
    
        # ------------------------------------------------------
        # Compute fields
        # ------------------------------------------------------
        @api.multi
        def _compute_payment_line_amount(self):
            for po in self:
                po.payment_line_amount = sum(
                    po.payment_line_ids.mapped('amount_currency')
                )
    
        @api.multi
        def _compute_bank_line_amount(self):
            for po in self:
                po.bank_line_amount = sum(
                    po.bank_line_ids.mapped('amount_currency')
                )
    
        @api.multi
        def _compute_attachment_ids(self):
            Attachment = self.env['ir.attachment']
            for po in self:
               po.attachment_ids = Attachment.search([
                   ('res_model', '=', 'account.payment.order'),
                   ('res_id', '=', po.id)
               ])
    
        # ------------------------------------------------------
        # Button function
        # ------------------------------------------------------
        def view_payment_line(self):
            tree_id = self.env.ref(
                'cgscop_cotisation.scop_account_payment_line_tree').id
            search_id = self.env.ref(
                'cgscop_cotisation.scop_account_payment_line_search').id
            return {
                'type': 'ir.actions.act_window',
                'name': "Lignes d'opérations",
                'res_model': 'account.payment.line',
                'views': [[tree_id, 'tree']],
                'search_view_id': [search_id, 'search'],
                'domain': [['order_id', '=', self.id]],
            }
    
        def view_account_move(self):
            tree_id = self.env.ref(
                'cgscop_cotisation.scop_account_move_tree').id
            search_id = self.env.ref(
                'cgscop_cotisation.scop_account_move_search').id
            return {
                'type': 'ir.actions.act_window',
                'name': "Pièces comptables de l'ordre de prélèvement",
                'res_model': 'account.move',
                'views': [[tree_id, 'tree'], [False, 'form']],
                'search_view_id': [search_id, 'search'],
                'domain': [['payment_order_id', '=', self.id]],
            }