Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1498 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 23
14920
0
thg 10 23
33
3
thg 10 23
790
1
thg 10 23
569
1
thg 8 23
2561