Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1495 Vistas

Hi, I try to include "('type', '=', 'invoice')" into the penultimate line  ->  

          domain.extend([('recurring_next_date', '<=', date_ref)])

in order to get  ->

          domain.extend([('recurring_next_date', '<=', date_ref),('type', '=', 'invoice')])

Is there any way to achive it? 


The original function is the following:


class ContractContract(models.Model):

    _name = 'contract.contract'


@api.model

    def _get_contracts_to_invoice_domain(self, date_ref=None):

        domain = []

        if not date_ref:

            date_ref = fields.Date.context_today(self)

        domain.extend([('recurring_next_date', '<=', date_ref)])

        return domain

Avatar
Descartar
Mejor respuesta

Hello,


You would have to inherit contract.contract

from odoo import models

class ContractContract(models.Model)
_inherit = 'contract.contract'

def _get_contracts_to_invoice_domain(self, date_ref=None):
res = super(ContractContract, self)._get_contracts_to_invoice_domain(date_ref)
res.append(('type', '=', 'invoice'))
return res
Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
dic 23
14918
0
oct 23
33
3
oct 23
790
1
oct 23
569
1
ago 23
2560