Skip to content

Commit

Permalink
[ADD]sale_stock_ux: Mass cancellation of remaining quantities
Browse files Browse the repository at this point in the history
X-original-commit: 482510f
  • Loading branch information
jok-adhoc committed Jan 31, 2023
1 parent 8f1901a commit 6e28527
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sale_stock_ux/__manifest__.py
Expand Up @@ -19,7 +19,13 @@
##############################################################################
{
'name': 'Sale Stock UX',
<<<<<<< HEAD
'version': "16.0.1.0.0",
||||||| parent of d240e542 (temp)
'version': "15.0.1.0.0",
=======
'version': "15.0.2.0.0",
>>>>>>> d240e542 (temp)
'category': 'Sales',
'sequence': 14,
'summary': '',
Expand All @@ -41,6 +47,7 @@
'views/stock_move_views.xml',
'wizards/sale_order_cancel_remaining.xml',
'wizards/stock_return_picking_views.xml',
'wizards/sale_order_massive_cancellation_remaining_views.xml',
],
'assets': {
'web.assets_qweb': [
Expand Down
5 changes: 5 additions & 0 deletions sale_stock_ux/security/ir.model.access.csv
@@ -1,3 +1,8 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_return_picking_wizard,access_stock_return_picking_wizard,model_stock_return_picking,base.group_user,1,1,1,0
<<<<<<< HEAD
access_sale_order_cancel_remaining_wizard,access_sale_order_cancel_remaining_wizard,model_sale_order_cancel_remaining,base.group_user,1,1,1,0
||||||| parent of d240e542 (temp)
=======
access_sale_order_massive_cancel_remaining_wizard,access_sale_order_massive_cancel_remaining_wizard,sale_stock_ux.model_sale_stock_ux_action_mass_cancel_remaining_wizard,base.group_user,1,1,1,0
>>>>>>> d240e542 (temp)
1 change: 1 addition & 0 deletions sale_stock_ux/wizards/__init__.py
Expand Up @@ -4,3 +4,4 @@
##############################################################################
from . import sale_order_cancel_remaining
from . import stock_return_picking
from . import sale_order_massive_cancellation_remaining
16 changes: 16 additions & 0 deletions sale_stock_ux/wizards/sale_order_massive_cancellation_remaining.py
@@ -0,0 +1,16 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models


class ActionCancel(models.TransientModel):
_name = "sale_stock_ux.action_mass_cancel_remaining.wizard"
_description = "Wizard to do a massive cancellation of remaining quantities "

def action_mass_cancel_remaining(self):
order = self.env['sale.order'].browse(self._context.get('active_ids', []))
records = order.mapped('order_line').filtered(lambda x: x.delivery_status == 'to deliver')
for rec in records:
rec.button_cancel_remaining()
@@ -0,0 +1,30 @@
<odoo>

<record id="view_action_mass_cancel_remaining" model="ir.ui.view">
<field name="name">sale_stock_ux.action_mass_cancel_remaining.wizard</field>
<field name="model">sale_stock_ux.action_mass_cancel_remaining.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<div class="alert alert-info" role="alert" style="margin-bottom:0px;">
Do you want to cancel remaining quantities for this orders?<b> This can't be undone</b>
</div>
</group>
<footer>
<button name="action_mass_cancel_remaining" string="Confirm" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>

<record model="ir.actions.act_window" id="action_mass_cancel_remaining_act_window">
<field name="name">Mass cancellation of remaining quantities</field>
<field name="res_model">sale_stock_ux.action_mass_cancel_remaining.wizard</field>
<field name='view_mode'>form</field>
<field name='target'>new</field>
<field name='binding_model_id' ref="sale.model_sale_order"/>
</record>

</odoo>

0 comments on commit 6e28527

Please sign in to comment.