Skip to content

Commit

Permalink
[FIX] confirmation_wizard: Usage file and wizard action are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 committed Aug 28, 2024
1 parent 43eedac commit d78f015
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 4 additions & 2 deletions confirmation_wizard/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@ Use confirm wizard which return method (return_type = method):
.. code-block:: python
def change_address(self, address):
if self._context("skip_confirm", False):
if not self._context("skip_confirm", False):
# Confirmation wizard
return (
self.env["confirmation.wizard"]
.with_context(skip_confirm=True)
.confirm_message(
"Are you ready change partner address",
_("Are you ready change partner address"),
records=self.env["res.partner"].browse(1), # One or more records
title="Confirm",
method="change_address",
callback_params={"address": address}
)
)
... # Your code here
Use confirm wizard which return window close (return_type = window_close):

Expand Down
6 changes: 4 additions & 2 deletions confirmation_wizard/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ Use confirm wizard which return method (return_type = method):
.. code-block:: python
def change_address(self, address):
if self._context("skip_confirm", False):
if not self._context("skip_confirm", False):
# Confirmation wizard
return (
self.env["confirmation.wizard"]
.with_context(skip_confirm=True)
.confirm_message(
"Are you ready change partner address",
_("Are you ready change partner address"),
records=self.env["res.partner"].browse(1), # One or more records
title="Confirm",
method="change_address",
callback_params={"address": address}
)
)
... # Your code here
Use confirm wizard which return window close (return_type = window_close):

Expand Down
8 changes: 5 additions & 3 deletions confirmation_wizard/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -389,18 +389,20 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Use confirm wizard which return method (return_type = method):</p>
<pre class="code python literal-block">
<span class="k">def</span> <span class="nf">change_address</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">address</span><span class="p">):</span><span class="w">
</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_context</span><span class="p">(</span><span class="s2">&quot;skip_confirm&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span><span class="w">
</span> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_context</span><span class="p">(</span><span class="s2">&quot;skip_confirm&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span><span class="w">
</span> <span class="c1"># Confirmation wizard</span><span class="w">
</span> <span class="k">return</span> <span class="p">(</span><span class="w">
</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">&quot;confirmation.wizard&quot;</span><span class="p">]</span><span class="w">
</span> <span class="o">.</span><span class="n">with_context</span><span class="p">(</span><span class="n">skip_confirm</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="w">
</span> <span class="o">.</span><span class="n">confirm_message</span><span class="p">(</span><span class="w">
</span> <span class="s2">&quot;Are you ready change partner address&quot;</span><span class="p">,</span><span class="w">
</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Are you ready change partner address&quot;</span><span class="p">),</span><span class="w">
</span> <span class="n">records</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">&quot;res.partner&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">browse</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="c1"># One or more records</span><span class="w">
</span> <span class="n">title</span><span class="o">=</span><span class="s2">&quot;Confirm&quot;</span><span class="p">,</span><span class="w">
</span> <span class="n">method</span><span class="o">=</span><span class="s2">&quot;change_address&quot;</span><span class="p">,</span><span class="w">
</span> <span class="n">callback_params</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;address&quot;</span><span class="p">:</span> <span class="n">address</span><span class="p">}</span><span class="w">
</span> <span class="p">)</span><span class="w">
</span> <span class="p">)</span>
</span> <span class="p">)</span><span class="w">
</span> <span class="o">...</span> <span class="c1"># Your code here</span>
</pre>
<p>Use confirm wizard which return window close (return_type = window_close):</p>
<pre class="code python literal-block">
Expand Down
2 changes: 2 additions & 0 deletions confirmation_wizard/wizard/confirmation_wizard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<field name="name">Confirmation</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">confirmation.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="confirmation_wizard_form_view" />
<field name="target">new</field>
</record>

Expand Down

0 comments on commit d78f015

Please sign in to comment.