Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2255 Zobrazení

Could anyone check if that inheritance is correct? or should I remove 'res' variable and a return? Thank you


    @api.model

    def cron_recurring_create_invoice(self, date_ref=None):

        if self.type == 'invoice':    ################################ my extra line

            res = super(ContractContract, self).cron_recurring_create_invoice()

            return res


    ### original def ######### 

    @api.model

    def cron_recurring_create_invoice(self, date_ref=None):

        if not date_ref:

            date_ref = fields.Date.context_today(self)

        domain = self._get_contracts_to_invoice_domain(date_ref)

        invoices = self.env["account.invoice"]

        # Invoice by companies, so assignation emails get correct context

        companies_to_invoice = self.read_group(domain, ["company_id"], ["company_id"])

        for row in companies_to_invoice:

            contracts_to_invoice = self.search(row["__domain"]).with_context(

                allowed_company_ids=[row["company_id"][0]]

            )

            invoices |= contracts_to_invoice._recurring_create_invoice(date_ref)

        return invoices



Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
7
čvn 24
24727
1
čvn 20
11603
1
srp 19
6531
4
úno 25
2360
1
srp 24
1984