mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 12:52:05 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import BasicModel from "web.BasicModel";
|
||||
|
||||
BasicModel.include({
|
||||
/**
|
||||
* Extend `_fetchModelFieldReference` to support `model_field_char`
|
||||
*/
|
||||
_fetchModelFieldReference: async function (record, fieldName, fieldInfo) {
|
||||
if (fieldInfo.options.model_field) {
|
||||
// Call the original method if `model_field` is defined
|
||||
return this._super.apply(this, arguments);
|
||||
} else if (fieldInfo.options.model_field_char) {
|
||||
const modelFieldChar = fieldInfo.options.model_field_char;
|
||||
const modelCharValue =
|
||||
(record._changes && record._changes[modelFieldChar]) ||
|
||||
record.data[modelFieldChar];
|
||||
|
||||
if (modelCharValue) {
|
||||
return {
|
||||
modelName: modelCharValue,
|
||||
hasChanged: true,
|
||||
};
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Extend `_fetchSpecialReference` to also consider `model_field_char`
|
||||
*/
|
||||
_fetchSpecialReference: function (record, fieldName, fieldInfo) {
|
||||
const field = record.fields[fieldName];
|
||||
if (field.type === "char") {
|
||||
return Promise.resolve(this._fetchReference(record, fieldName));
|
||||
} else if (fieldInfo.options.model_field) {
|
||||
return this._fetchModelFieldReference(record, fieldName, fieldInfo);
|
||||
} else if (fieldInfo.options.model_field_char) {
|
||||
return this._fetchModelFieldReference(record, fieldName, fieldInfo);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue