I have modified crm_opportunity_report :
added a boolean field
is_customer = fields.Boolean('Is customer', readonly=True)
added a field to the view
CREATE VIEW crm_opportunity_report AS ( SELECT <...>omitted<...> rp.customer as is_customer FROM "crm_lead" c LEFT JOIN "res_partner" rp ON rp.id = c.partner_id <...>omitted<...> GROUP BY c.id, stage.name, is_customer
After this in the report when I click "+" and choose "Is customer" sometimes value Undefined
appears as a value for it.
Tried this: COALESCE(rp.customer, FALSE) as is_customer
(and the same in Group by) but "Undefined" is still present.
How in Odoo report I can make Undefined
mean False
so that when it's "Undefined" appears "False"?
Note: when debugging with Firefox I can observe that from the server comes (jsonrpc) data with either "is_customer: false" or "is_customer: true" on items of report. But somehow those items that have "is_customer: false" on the report view are displayed as if "is_customer: Undefined".
Update
Somewhat accidentally I stumbled upon this line
if (value === false) return _t("Undefined");
What might be the reason behind this logic: 'if value is false return "Undefined"'?
Funny part, I can add if (value === true) return _t("Whatever");
:)
partner_id
and are this undefined instead ofFalse
? – traviswis customer
(set to true) because "customer(boolean)" field comes fromres_partner
. Anyway those should have False either because ofCOALESCE(rp.customer, FALSE)
. And they have... But in report false values appear as "Undefined" . – Developer Marius ŽilėnasCOALESCE(rp.customer, 'f')
? As you found, Odoo will translateFalse
to "Undefined", but it ought to translate'f'
to "False" since that's how it stores in the database. – travisw