[IMP] account_edi: cron is disabled by default
The cron to send the invoice to web-services is disabled until an edi.format that needs web services is created closes odoo/odoo#56131 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -7,5 +7,6 @@
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">minutes</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="active">False</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -33,12 +33,17 @@ class AccountEdiFormat(models.Model):
|
||||
def create(self, vals_list):
|
||||
edi_formats = super().create(vals_list)
|
||||
|
||||
# activate by default on journal
|
||||
journals = self.env['account.journal'].search([])
|
||||
for journal in journals:
|
||||
for edi_format in edi_formats:
|
||||
if edi_format._is_compatible_with_journal(journal):
|
||||
journal.edi_format_ids += edi_format
|
||||
|
||||
# activate cron
|
||||
if any(edi_format._needs_web_services() for edi_format in edi_formats):
|
||||
self.env.ref('account_edi.ir_cron_edi_network').active = True
|
||||
|
||||
return edi_formats
|
||||
|
||||
####################################################
|
||||
|
||||
Reference in New Issue
Block a user