[FIX] l10n_it_edi_sdicoop: empty invoice company
When the cron is fetching the xml from the database, an empty invoice with the xml as an attachment is created. The reason for this is so that, if the import fails, there is at least a file accessible on the invoice for the purposes of debugging. When the cron's fetching function loops through the proxy users for each company, fetching the results from the proxy server for each company in turn. However when the empty invoice is created, the company is not provided, and thus the context company is used (that of the cron), which is not necessarily correct. This commit uses the company of the proxy to create the empty invoice (which in turn selects the correct journal etc. for the empty invoice). closes odoo/odoo#92830 Ticket-id: 2854284 X-original-commit: a19cdf82f3276f84fba2961fbd82a5a1a2f7844e Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
This commit is contained in:
@@ -51,8 +51,7 @@ class AccountEdiFormat(models.Model):
|
||||
# should not happen as the file has been checked by SdiCoop
|
||||
_logger.info('Received file badly formatted, skipping: \n %s', file)
|
||||
continue
|
||||
|
||||
invoice = self.env['account.move'].create({'move_type': 'in_invoice'})
|
||||
invoice = self.env['account.move'].with_company(company).create({'move_type': 'in_invoice'})
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'name': fattura['filename'],
|
||||
'raw': file,
|
||||
|
||||
Reference in New Issue
Block a user