[FIX] account: fix send sample invoice

With company country and localization set to Peru
Go to invoice dashboard
Click on 'Send sample'

User will receive the warning
'If you want to use "Off-Balance Sheet" accounts, all the accounts of the
journal entry must be of this type'
and the action will abort because the first account fetched for the
operation is an 'Off Balance' account

opw-2300813

closes odoo/odoo#55509

X-original-commit: 27a9eb3083e7938199ff047060135e030496eec0
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-08-06 07:43:46 +00:00
parent 3178fb21b4
commit dda65902c2
+1
View File
@@ -428,6 +428,7 @@ class ResCompany(models.Model):
"\nPlease go to Configuration > Journals.")
raise RedirectWarning(msg, action.id, _("Go to the journal configuration"))
account = journal.default_credit_account_id or account
sample_invoice = self.env['account.move'].with_context(default_move_type='out_invoice', default_journal_id=journal.id).create({
'payment_reference': _('Sample invoice'),
'partner_id': partner.id,