Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2262 Weergaven

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
7
jun. 24
24756
1
jun. 20
11622
1
aug. 19
6543
4
feb. 25
2401
1
aug. 24
2012