[FIX] account_reconcile_oca: account name can be translatable
By default, account_account name is a char field. But if l10n_multilang is installed, it is translatable, hence the DB column is now a jsonb. We must handle both cases in the select query.pull/553/head
parent
6eda7e605a
commit
4fa4e1faa1
|
@ -34,10 +34,18 @@ class AccountAccountReconcile(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _select(self):
|
def _select(self):
|
||||||
return """
|
account_account_name_field = self.env["ir.model.fields"].search(
|
||||||
|
[("model", "=", "account.account"), ("name", "=", "name")]
|
||||||
|
)
|
||||||
|
account_name = (
|
||||||
|
f"a.name ->> '{self.env.user.lang}'"
|
||||||
|
if account_account_name_field.translate
|
||||||
|
else "a.name"
|
||||||
|
)
|
||||||
|
return f"""
|
||||||
SELECT
|
SELECT
|
||||||
min(aml.id) as id,
|
min(aml.id) as id,
|
||||||
MAX(a.name) as name,
|
MAX({account_name}) as name,
|
||||||
aml.partner_id,
|
aml.partner_id,
|
||||||
a.id as account_id,
|
a.id as account_id,
|
||||||
FALSE as is_reconciled,
|
FALSE as is_reconciled,
|
||||||
|
|
Loading…
Reference in New Issue