Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1513 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
dec. 23
14927
0
oct. 23
33
3
oct. 23
790
1
oct. 23
569
1
aug. 23
2565