[FIX] l10n_mx: add missing decorator on create method
Currently, if you install the Mexican localization, you are no longer able to create a new account in the chart of accounts. Steps to reproduce ------------------ * install `l10n_mx` * attempt to create a new account in the chart of accounts You should be met with a traceback: `TypeError: AccountAccount.create() missing 1 required positional argument: 'vals_list'` Cause ----- The `@api.model` and `@api.model_create_multi` decorators in indicate that a method is intended to operate at the model level rather than on specific record instances. Without these decorators, the system defaults to treating methods as if they are meant to be executed on the record level. This distinction significantly impacts how methods are invoked through RPC. In RPC scenarios, Odoo's default expectation for record-level methods is that the RPC call will include the IDs of the records to which the method applies, alongside any actual method arguments necessary for the operation. Here, `create()` is called through RPC, as a model-level method (i.e, without record IDs). This makes sense because `create()` is always a model-level method. However, in our case, create is a record-level method, so the system expects the RPC call to contain record IDs. This mismatch produces a traceback. Issue introduced by 858bf9efdd9fcc29a73336863a51227c15cc19f0 opw-3772520 opw-3772469 opw-3772287 opw-3771854 opw-3771361 closes odoo/odoo#156163 X-original-commit: 59a49bda5607e8a12cf153c4338785de42cde90c Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from odoo import Command, models
|
||||
from odoo import api, Command, models
|
||||
|
||||
|
||||
class AccountAccount(models.Model):
|
||||
_inherit = 'account.account'
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
# EXTENDS account - ensure there is a tag on created MX accounts
|
||||
# The computation is a bit naive and might not be correct in all cases.
|
||||
|
||||
Reference in New Issue
Block a user