Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2237 Prikazi

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
7
jun. 24
24699
1
jun. 20
11549
1
avg. 19
6508
4
feb. 25
2327
1
avg. 24
1969