forked from Techsystech/web
port web_readonly_bypass on v7
parent
6966470f9d
commit
991c74746c
|
@ -3,14 +3,6 @@
|
||||||
#
|
#
|
||||||
# Authors: Nemry Jonathan & Laetitia Gangloff
|
# Authors: Nemry Jonathan & Laetitia Gangloff
|
||||||
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
|
||||||
# All Rights Reserved
|
|
||||||
#
|
|
||||||
# WARNING: This program as such is intended to be used by professional
|
|
||||||
# programmers who take the whole responsibility of assessing all potential
|
|
||||||
# consequences resulting from its eventual inadequacies and bugs.
|
|
||||||
# End users who are looking for a ready-to-use solution with commercial
|
|
||||||
# guarantees and support are strongly advised to contact a Free Software
|
|
||||||
# Service Company.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -29,8 +21,8 @@
|
||||||
{
|
{
|
||||||
'name': 'Read Only ByPass',
|
'name': 'Read Only ByPass',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
"author": "ACSONE SA/NV",
|
"author": "ACSONE SA/NV, Anybox",
|
||||||
"maintainer": "ACSONE SA/NV",
|
"maintainer": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||||
"website": "http://www.acsone.eu",
|
"website": "http://www.acsone.eu",
|
||||||
'category': 'Technical Settings',
|
'category': 'Technical Settings',
|
||||||
'depends': [
|
'depends': [
|
||||||
|
@ -38,24 +30,86 @@
|
||||||
'web',
|
'web',
|
||||||
],
|
],
|
||||||
'description': """
|
'description': """
|
||||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
|
||||||
Read Only ByPass
|
Read Only ByPass
|
||||||
================
|
================
|
||||||
This Module provides a solution to the problem of the interaction between
|
|
||||||
'readonly' attribute and 'on_change' attribute when used together
|
|
||||||
|
|
||||||
Behavior: add `readonly_fields` changed by `on_change` into the fields passing
|
This module provides a solution to the problem of the interaction between
|
||||||
into an update or create. If `filter_out_readonly` is into the context and set
|
'readonly' attribute and 'on_change' attribute when used together. It allows
|
||||||
|
saving onchange modifications to readonly fields.
|
||||||
|
|
||||||
|
Behavior: add readonly fields changed by `on_change` methods to the values
|
||||||
|
passed to write or create. If `filter_out_readonly` is in the context and
|
||||||
True then apply native behavior.
|
True then apply native behavior.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
There are no specific installation instructions for this module.
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
|
There is nothing to configure.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
This module changes the default behaviour of Odoo by propagating
|
||||||
|
on_change modifications to readonly fields to the backend create and write
|
||||||
|
methods.
|
||||||
|
|
||||||
|
To restore the standard behaviour, set `filter_out_readonly` in the context.
|
||||||
|
|
||||||
|
For further information, please visit:
|
||||||
|
|
||||||
|
* https://www.odoo.com/forum/help-1
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||||
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
|
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
|
||||||
|
`here <https://github.com/OCA/web/issues/new?body=module:%20web_readonly_bypass%0Aversion:%208.0.1.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Jonathan Nemry <jonathan.nemry@acsone.eu>
|
||||||
|
* Laetitia Gangloff <laetitia.gangloff@acsone.eu>
|
||||||
|
* Pierre Verkest <pverkest@anybox.fr>
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
:target: https://odoo-community.org
|
||||||
|
|
||||||
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.
|
||||||
|
|
||||||
|
To contribute to this module, please visit http://odoo-community.org.
|
||||||
""",
|
""",
|
||||||
'images': [],
|
'js': [
|
||||||
'data': [
|
'static/src/js/readonly_bypass.js',
|
||||||
'views/readonly_bypass.xml',
|
|
||||||
],
|
],
|
||||||
'qweb': [
|
|
||||||
],
|
|
||||||
'css': [],
|
|
||||||
'demo': [],
|
|
||||||
'test': [],
|
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
|
'application': False,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Allow to bypass readonly fi the value is changed
|
* Allow to bypass readonly fi the value is changed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openerp.readonly_bypass = function(instance) {
|
openerp.web_readonly_bypass = function(instance) {
|
||||||
|
|
||||||
var QWeb = instance.web.qweb, _t = instance.web._t;
|
var QWeb = instance.web.qweb, _t = instance.web._t;
|
||||||
/**
|
/**
|
||||||
|
@ -19,8 +19,9 @@ openerp.readonly_bypass = function(instance) {
|
||||||
*/
|
*/
|
||||||
function ignore_readonly(data, options, mode, context){
|
function ignore_readonly(data, options, mode, context){
|
||||||
if (options){
|
if (options){
|
||||||
if (!('filter_out_readonly' in context && context['filter_out_readonly'] == true
|
if ('readonly_fields' in options && options['readonly_fields'] &&
|
||||||
&& 'readonly_fields' in options && options['readonly_fields'])) {
|
!('filter_out_readonly' in context &&
|
||||||
|
context['filter_out_readonly'] == true)) {
|
||||||
if(mode){
|
if(mode){
|
||||||
$.each( options.readonly_fields, function( key, value ) {
|
$.each( options.readonly_fields, function( key, value ) {
|
||||||
if(value==false){
|
if(value==false){
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- vim:fdn=3:
|
|
||||||
-->
|
|
||||||
<openerp>
|
|
||||||
<data>
|
|
||||||
<template id="assets_backend" name="readonly_bypass" inherit_id="web.assets_backend">
|
|
||||||
<xpath expr="." position="inside">
|
|
||||||
<script type="text/javascript" src="/readonly_bypass/static/src/js/readonly_bypass.js"></script>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
Loading…
Reference in New Issue