custom module installation error on odoo 14 - report

ValueError: ir.actions.report.report_type: required selection fields must define an ondelete policy that implements the proper cleanup of the corresponding records upon module uninstallation. Please use one or more of the following policies: 'set default' (if the field has a default defined), 'cascade', or a single-argument callable where the argument is the recordset containing the specified option.

You need to declare like this :
report_type = fields.Selection(
selection_add=[('sale', 'sale')],
ondelete={'sale': 'cascade'}
)
or you can also add this as per the requirement :
ondelete={'sale': 'set default'})

If you guys get this issue when database is cached, then try this (otherwise, ignore this solution):
Add dbfilter to odoo.conf:
dbfilter = ^your_db_name*
Then restart the server and go to /web/database/selector and select your db

Related

Error during compiling: `identifier not found` (code C3861)

I have a field in my acore_characters table named 'rank' with a tinyint which ranges from 0 to 3 inclusive, based on player's progression. I need to read that value at both login and at certain specific circumstances.
I wrote the following PreparedStatement: "SELECT rank FROM acore_characters WHERE guid = ?" and then the code which is supposed to read that value:
uint16 GetCharactersRank(uint64 guid) {
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(mystatement);
stmt->setUInt32(0, GetGUID());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result) {
[...truncated]
and then fetching the result and so on, but then I get a code C8361 when compiling because 'GetGUID':identifier not found in Player.cpp file...what goes wrong? The other GetGUID calls throughout the file dont give this result. I'm not very fond of c++, any help is very appreciated.
It's not recommended to directly patch the core to add customisations to it. Instead, use modules.
An example can be found here: Is it possible to turn a core patch into a module for AzerothCore?
You can have a look and copy the skeleton-module and start modifying it to create your own.
In your case, you probably want to use the OnLogin player hook.

Fetching translated allowed_values of non-translatable list_string field

I'm attempting to get the allowed_values of a non-translatable list_string field. The allowed_values of this field are translated though and we want to get those allowed_values into a specific language & not the current UI one.
Here is my draft attempt:
// Override language before loading field configuration.
$this->languageManager->setConfigOverrideLanguage($this->languageManager->getLanguage('fr'));
// Load the field configuration in the language forced before.
$field_info = $this->fieldConfigStorage->load('profile.customer.field_title');
$label = $field_info->getLabel();
$allowed_values = $field_info->getSetting('allowed_values');
// Dump values for debugging.
dump($label);
dump($field_info);
dump($allowed_values);
With my current code, I get the proper forced label (here fr) but when I use the ::getSetting('allowed_values') I receive the allowed_values in the current UI language instead of forced one.
Does any one have any idea ?
Many thanks.

Configuration of plugins

I try to use the following plugins in local mode:
s.Util.cookieRead https://marketing.adobe.com/resources/help/en_US/sc/implement/util_cookieread.html
s.Util.cookieWrite https://marketing.adobe.com/resources/help/en_US/sc/implement/util_cookiewrite.html
When I type in console i.e. s.Util.getQueryParam I take back the function which seems that the configuration in file it is allright.
s.Util.getQueryParam
AppMeasurement.a.Util.getQueryParam(c, b, d)
How ever when I go to add the example in plugin function
s.campaign = s.Util.getQueryParam("cid");
when I run my site I can't see anything of this plugin
Also when I use the
getNewRepeat https://marketing.adobe.com/resources/help/en_US/sc/implement/getNewRepeat.html
plugin it always shows me as New visitor.
Is there any special configuration I should make in order to make them to work properly?
// set a session cookie named foo to value 'bar'
s.Util.cookieWrite('foo','bar');
// look for cookie named 'foo' and return value if found, and assign it to prop1
s.prop1 = s.Util.cookieRead('foo');

SAP HANA custom dictionary: full-text-index not generated or updated

There are two problems with SAP HANA custom dictonaries.
Updating and recompiling the dictionary has no effect on the full-text-index table (even by dropping and generating the full-text-index again)
using custom dictionaries & configuration may lead to an empty fulltext-index-table
For the 1. Problem
deleting the configuration file and replace it with a new file (same content but different file name) then activating all changes (activates the deletion of the old config and adds the new config) seems to be a work-around.
Note: this means you also have to change the configuration name in the SQL command.
For the 2. Problem
Check this trace file:
/usr/sap/HDB/HDB00/hanadb/trace/preprocessor_alert_hanadb.trc
This error message:
File read Error '/usr/sap/HDB/SYS/global/hdb/custom/config/lexicon//EXTRACTION_CORE_MOD2', error='Storage object does not exist: $STORAGEOBJECT$'
occurs if the configuration file EXTRACTION_CORE_MOD2 is not properly activated in the repository under sap.hana.ta.config. So double check the repository if the configuration file exists in the specified path.
For the first problem, I have the same scenario in which I need to make some changes in the custom dictionary and activated it. It did not affect my index table unit I run the following statement:
ALTER INDEX MYINDEX REBUILD;
I have checked it and the changes affect the index table by this statement. So you do not have to remove your index or save the changes of your custom dictionary in a file with new name.

Drupal using views with CCK custom fields

I've got a Drupal site which uses a custom field for a certain type of node (person_id) which corresponds to a particular user. I want to create a view so that when logged in, a user can see a list of nodes 'tagged' with their person_id. I've got the view working fine, with a url of my-library/username but replacing username with a different username shows a list of all nodes tagged with that user. What I want to do is stop users changing the URL and seeing other users' tagged nodes. How can I do this? Is there somewhere where I can dictate that the only valid argument for this page is the one that corresponds with the current logged in user's username?
person_id = uid?
In this case, add argument with user:uid, then in Validation options select PHP Code, read comment of this field carefully:
Enter PHP code that returns TRUE or
FALSE. No return is the same as FALSE,
so be SURE to return something if you
do not want to declare the argument
invalid. Do not use . The
argument to validate will be
"$argument" and the view will be
"$view". You may change the argument
by setting "$handler->argument".
Add this code:
global $user;
$account = user_load('name'=>arg(1));
$handler->argument = $user->uid;
return $account->uid == $user->uid;
I'm not sure how you have setup your view, which gives some different options to solve this. A way that should work would be to set the default argument be the logged users id/username and remove the argument from the url.
Alternatively you could create your own filter which requires some work with the views API, but gives more control.

Resources