odoo/odoo#163432

Created by fw-bot
label
odoo-dev:17.0-16.0-fix-l10n-es-edi-tbai-chain-sequence-HD-V-fw
head
26bd66076125c150fa182fcf1ffa7961074fb7a1
target
17.0
merged
3 weeks ago by Accounting, William André (wan)
forward-port of
odoo/odoo#162433

[FW][FIX] [16.0] l10n_es_edi_tbai, sudo on company when creating TicketBAI chain sequence for the first time

Description of the issue/feature this PR addresses:

Spain localization l10n_es_edi_tbai module, sudo on company when creating TicketBAI chain sequence for the first time to avoid raise of access security errors without Administration/Settings.

Current behavior before PR:

When creating the first invoice, TicketBAI chain sequence does not exists therefore it is created, if user does not belong to Administration/Settings group, an access error is raised and invoice is not posted. In the same time, a write operation is done in the company to set the value of the sequence on l10n_es_tbai_chain_sequence_id field, and writing in a company only is allowed for users that belongs to Administration/Settings.

Desired behavior after PR is merged:

We make a sudo in self (res.company) with a user with account permission but not Administration/Settings, no errors are raised, invoice is posted and TicketBAI XML file is created and posted to the agency.


---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: odoo/odoo#162433