Merge pull request #5201 from expsa/kch_dev_odex25_base
[ADD] syn_disable_quick_create: Disable Quick Create
This commit is contained in:
commit
9f0b5bd6b4
|
|
@ -0,0 +1 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name": "Disable Quick Create",
|
||||||
|
"version": "14.0.1.0.0",
|
||||||
|
"summary": "Disable all Create / Create & Edit / Quick Create buttons for Many2One and Many2Many fields",
|
||||||
|
"category": "Custom",
|
||||||
|
'author': 'Muhammad Altayyar',
|
||||||
|
"depends": ["web"],
|
||||||
|
"data": [
|
||||||
|
"views/assets.xml",
|
||||||
|
],
|
||||||
|
"installable": True,
|
||||||
|
"application": False,
|
||||||
|
"auto_install": False,
|
||||||
|
"images": ["static/description/icon.png"],
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'price': 0.00,
|
||||||
|
'currency': 'USD',
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
|
|
@ -0,0 +1,72 @@
|
||||||
|
odoo.define('syn_disable_quick_create.disable_relational_create', function (require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var relational_fields = require('web.relational_fields');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend FieldMany2One to disable all create options
|
||||||
|
*/
|
||||||
|
relational_fields.FieldMany2One.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
// Disable all create options for Many2One fields
|
||||||
|
this.can_create = false;
|
||||||
|
this.nodeOptions.no_create = true;
|
||||||
|
this.nodeOptions.no_quick_create = true;
|
||||||
|
this.nodeOptions.no_create_edit = true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend FieldMany2ManyTags to disable all create options
|
||||||
|
*/
|
||||||
|
relational_fields.FieldMany2ManyTags.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
// Disable all create options for Many2Many Tags fields
|
||||||
|
this.can_create = false;
|
||||||
|
this.nodeOptions.no_create = true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend FormFieldMany2ManyTags (editable tags in form view) to disable all create options
|
||||||
|
*/
|
||||||
|
if (relational_fields.FormFieldMany2ManyTags) {
|
||||||
|
relational_fields.FormFieldMany2ManyTags.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
// Disable all create options for editable Many2Many Tags
|
||||||
|
this.can_create = false;
|
||||||
|
this.nodeOptions.no_create = true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend FieldMany2ManyCheckBoxes to disable all create options
|
||||||
|
*/
|
||||||
|
if (relational_fields.FieldMany2ManyCheckBoxes) {
|
||||||
|
relational_fields.FieldMany2ManyCheckBoxes.include({
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
// Disable all create options
|
||||||
|
this.can_create = false;
|
||||||
|
this.nodeOptions.no_create = true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<template id="assets_backend" name="disable_quick_create assets" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr="." position="inside">
|
||||||
|
<script type="text/javascript" src="/syn_disable_quick_create/static/src/js/disable_relational_create.js"></script>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in New Issue