XML ids of records created via CSV data files are not recognized when referenced in python code or XML data files
Closed this issue ยท 11 comments
Hi @trinhanhngoc,
I've noticed that XML ids of records created via CSV data files are not recognized when referenced in python code or XML data files.
Here's an example:
CSV data file for model acccount.account.template
and record with xml_id l10n_rs.rs_472
https://github.com/odoo/odoo/blob/16.0/addons/l10n_rs/data/account.account.template.csv#L217
When referenced from the XML data file:
When referenced from the python file:
Cheers,
Petar
Hi @pnajman-modoolar , does your module already depend on l10_rs
? I just tested and it works for me:
account_move.py
in l10n_rs
Hi, @trinhanhngoc ,
Yes, of course, my module has dependency to module l10n_rs
as I'm writing extensions for it.
Dependency to that module is not direct but indirect (i.e. my_module depends on -> module_x depends on -> l10n_rs)
I've just tried it directly from within the module l10n_rs
(as per yours example) and it does work for me as well, but on my side it's still not working from the extension module for some reason.
Any ideas?
I've tried to clear the cache and to remove/add "Project Structure/Content Root" (including odoo-stubs) as this have helped in the pasted, but it didn't help.
I have latest Pycharm: 2023.1.2 PE
And latest Odoo plugin: 2023.5.6.231
Hi @pnajman-modoolar , I just tried with both direct and indirect dependencies on l10n_rs
and it still works for me. Can you try adding l10n_rs
as a direct dependency to see if the problem is related to indirect dependencies?
@trinhanhngoc , I've added direct dependency, but still the same :(
@pnajman-modoolar l10n_rs
adds a new field l10n_rs_turnover_date
to the model account.move
. Do you get this field in code completion for account.move
members like this:
@trinhanhngoc No, I don't have that field in code completion :(
@pnajman-modoolar Are you able to do a Go To Declaration (ctrl+click) on the l10n_rs
reference in your module manifest?
Hi @trinhanhngoc. it works now. I've closed Pycharm and physically deleted Pycharm cache folder from file system. After that it all works. Previously I've invalidated cache from within Pycharm which didn't help.
Thank you very much for your assistance.
Cheers,
Petar
Hi @trinhanhngoc , it must be one of "those" glitches as it didn't make sense to not work for only one module.
Hi @trinhanhngoc , it must be one of "those" glitches as it didn't make sense to not work for only one module.
@pnajman-modoolar PyCharm and other IntelliJ IDEs sometimes have problems with corrupt caches and indexes. Usually, just doing Invalidate caches is enough.