Skip to content
Extraits de code Groupes Projets
account_payment_order.py 618 octets
Newer Older
  • Learn to ignore specific revisions
  • # Copyright 2020 Le Filament
    # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
    
    from odoo import fields, models, api
    
    
    class ModelName(models.Model):
        _inherit = 'account.payment.order'
    
        attachment_ids = fields.One2many(
            comodel_name='ir.attachment',
            compute='_compute_attachment_ids'
        )
    
        @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)
               ])