تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2218 أدوات العرض

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



الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
7
يونيو 24
24692
1
يونيو 20
11541
1
أغسطس 19
6493
4
فبراير 25
2312
1
أغسطس 24
1962