stock_usability: Add 'set qty to 0' button on return wizard
This commit is contained in:
@@ -4,3 +4,4 @@ from . import stock
|
||||
from . import procurement
|
||||
from . import product
|
||||
from . import partner
|
||||
from . import wizard
|
||||
|
||||
@@ -30,6 +30,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'stock_view.xml',
|
||||
'procurement_view.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/stock_picking_return_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
3
stock_usability/wizard/__init__.py
Normal file
3
stock_usability/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import stock_picking_return
|
||||
17
stock_usability/wizard/stock_picking_return.py
Normal file
17
stock_usability/wizard/stock_picking_return.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2020 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class StockReturnPicking(models.TransientModel):
|
||||
_inherit = 'stock.return.picking'
|
||||
|
||||
def set_quantity_zero(self):
|
||||
self.ensure_one()
|
||||
self.product_return_moves.write({'quantity': 0})
|
||||
action = self.env.ref('stock.act_stock_return_picking').read()[0]
|
||||
action['res_id'] = self.id
|
||||
return action
|
||||
23
stock_usability/wizard/stock_picking_return_view.xml
Normal file
23
stock_usability/wizard/stock_picking_return_view.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2020 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_stock_return_picking_form" model="ir.ui.view">
|
||||
<field name="model">stock.return.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_return_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_return_moves" position="before">
|
||||
<button name="set_quantity_zero" type="object"
|
||||
string="⇒ Set quantities to 0" class="oe_link oe_right" colspan="2"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user