[14.0][ADD] web_create_write_confirm

This commit is contained in:
Ilyas
2023-04-25 09:48:29 +02:00
parent 320099cc10
commit 55ba3aab3b
18 changed files with 405 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
* `Smile <https://www.smile.eu/en>`_
* `Ooops404 <https://www.ooops404.com>`__:
* Ilyas <irazor147@gmail.com>

View File

@@ -0,0 +1,3 @@
This module provides feature to create custom confirmation or alert dialog when user creates or writes record.
Module includes only methods that you can use in your code. That means programming is always required.
See usage section for more information.

View File

@@ -0,0 +1,34 @@
Create popup.message record. Specify model_id, field_ids (which fields will trigger alert) and other fields.
Put you code into **get_message_informations** or **execute_processing** method of you model.
Return dict (perform read() to get it).
Here is some examples how you can use this module features in your code.
Confirm res.partner change:
.. code-block:: python
msg = self.env['popup.message'].create(
{
'model_id': self.env['ir.model'].search([('model', '=', 'res.partner')]).id,
'field_ids': [(6, 0, self.env['ir.model.fields'].search([('model', '=', 'res.partner')]).ids)],
'popup_type': 'confirm',
'title': 'Warning',
'message': 'Are you sure want to update record?',
}
)
return msg.read()
Sale order alert:
.. code-block:: python
msg = self.env['popup.message'].create(
{
'model_id': self.env['ir.model'].search([('model', '=', 'sale.order')]).id,
'field_ids': [(6, 0, self.env['ir.model.fields'].search([('model', '=', 'sale.order')]).ids)],
'popup_type': 'alert',
'title': 'Attention',
'message': 'Sale order was updated.',
}
)
return msg.read()