コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1503 ビュー

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

アバター
破棄
最善の回答

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
アバター
破棄
関連投稿 返信 ビュー 活動
2
12月 23
14926
0
10月 23
33
3
10月 23
790
1
10月 23
569
1
8月 23
2563