Skip to Content
Menu
This question has been flagged
1 Reply
1210 Views

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
2
Dec 23
12009
0
Oct 23
33
3
Oct 23
787
1
Oct 23
569
1
Aug 23
981