You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ================
  5. Read Only ByPass
  6. ================
  7. This module provides a solution to the problem of the interaction between
  8. 'readonly' attribute and 'on_change' attribute when used together. It allows
  9. saving onchange modifications to readonly fields.
  10. Behavior: add readonly fields changed by `on_change` methods to the values
  11. passed to write or create. If `readonly_by_pass` is in the context and
  12. True then it will by pass readonly fields and save its data provide by onchange
  13. method.
  14. Usage
  15. =====
  16. This module changes the behaviour of Odoo by propagating
  17. on_change modifications to readonly fields to the backend create and write
  18. methods.
  19. To change that behavior you have to set context on ``ur.actions.act_window``::
  20. <record id="sale.action_quotations" model="ir.actions.act_window">
  21. <field name="context">{'readonly_by_pass': True}</field>
  22. </record>
  23. or by telling fields allowed to change::
  24. <record id="sale.action_quotations" model="ir.actions.act_window">
  25. <field name="context">
  26. {'readonly_by_pass': ['readonly_field_1', 'readonly_field_2',]}
  27. </field>
  28. </record>
  29. On one2many fields, you can also pass the context in the field definition:
  30. <field name="one2many_field" context="{'readonly_by_pass': True}"/>
  31. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  32. :alt: Try me on Runbot
  33. :target: https://runbot.odoo-community.org/runbot/162/8.0
  34. Bug Tracker
  35. ===========
  36. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
  37. In case of trouble, please check there if your issue has already been reported.
  38. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
  39. `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**>`_.
  40. Credits
  41. =======
  42. Contributors
  43. ------------
  44. * Jonathan Nemry <jonathan.nemry@acsone.eu>
  45. * Laetitia Gangloff <laetitia.gangloff@acsone.eu>
  46. * Pierre Verkest <pverkest@anybox.fr>
  47. Maintainer
  48. ----------
  49. .. image:: https://odoo-community.org/logo.png
  50. :alt: Odoo Community Association
  51. :target: https://odoo-community.org
  52. This module is maintained by the OCA.
  53. OCA, or the Odoo Community Association, is a nonprofit organization whose
  54. mission is to support the collaborative development of Odoo features and
  55. promote its widespread use.
  56. To contribute to this module, please visit http://odoo-community.org.