[11.0][IMP] Add optional encoded reason management

This commit is contained in:
hveficent
2019-01-02 17:16:43 +01:00
committed by Adrià Gil Sorribes
parent 613f85c5f1
commit 767584e85a
19 changed files with 394 additions and 54 deletions

View File

@@ -26,13 +26,35 @@ Stock Change Quantity Reason
|badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the product stock management and allows to set a reason
in the wizard when changing the product quantity.
in the wizard when changing the product quantity or in inventory adjustments
per line.
It also can manage preset reasons optionally.
**Table of contents**
.. contents::
:local:
Configuration
=============
To enable preset reason feature, you must:
- Go to: Inventory > Settings > Inventory Adjustment
- Enable: Preset Change Qty Reason
- Enable: Technical Settings > Manage Stock Change Qty Preset Reasons
Once is activate you will require te add a Preset reason to validate stock
products change quantity.
To allow an Stock Manager configure preset reasons easily, you should:
- Select Stock Manager user on: Settings > Users
- Enable: Technical Settings > Manage Stock Change Qty Preset Reasons
- Go to Inventory > Configuration > Inventory Adjustment > Change Qty Reasons
Bug Tracker
===========
@@ -57,6 +79,7 @@ Contributors
* Denis Roussel <denis.roussel@acsone.eu>
* Meyomesse Gilles <meyomesse.gilles@gmail.com>
* Andreas Dian S.P <andreasdian777@gmail.com>
* Héctor Villarreal <hector.villarreal@eficent.com>
Maintainers
~~~~~~~~~~~

View File

@@ -1,18 +1,24 @@
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Stock Change Quantity Reason",
'summary': """
Stock Quantity Change Reason """,
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'website': "http://acsone.eu",
'website': "https://github.com/OCA/stock-logistics-warehouse",
'category': 'Warehouse Management',
'version': '11.0.1.0.0',
'version': '11.0.2.0.0',
'license': 'AGPL-3',
'depends': [
'stock',
],
'data': [
'security/ir.model.access.csv',
'security/stock_security.xml',
'views/base_config_view.xml',
'views/stock_inventory_line_reason_view.xml',
'views/stock_inventory_line_view.xml',
'wizard/stock_product_change_qty.xml'
],
'installable': True,

View File

@@ -1,3 +1,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import res_config_settings
from . import stock_inventory_line
from . import stock_inventory_line_reason
from . import stock_move

View File

@@ -0,0 +1,14 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_qty_reason_preset = fields.Boolean(
string="Preset Change Qty Reason",
required=True,
implied_group='stock_change_qty_reason.group_qty_reason_preset',
help="Enable use of predefined Reasons to manage Inventory Adjustments"
"and Product Update Quantities Wizard.")

View File

@@ -1,22 +1,28 @@
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import fields, models
class StockInventoryLine(models.Model):
"""Class to inherit model stock.inventory.line"""
_inherit = "stock.inventory.line"
reason = fields.Char(help='Type in a reason for the '
'product quantity change')
preset_reason_id = fields.Many2one('stock.inventory.line.reason')
def _get_move_values(self, qty, location_id, location_dest_id, out):
"""Function to super _get_move_value"""
res = super(StockInventoryLine, self)._get_move_values(
qty, location_id, location_dest_id, out)
context = self.env.context.get(
'change_quantity_reason', False) or self.reason \
if not self.preset_reason_id else self.preset_reason_id.name
if res.get('origin'):
res['origin'] = ' ,'.join(
[res.get('origin'),
self.env.context.get('change_quantity_reason', False)])
res['origin'] = ' ,'.join([res.get('origin'), context])
else:
res['origin'] = self.env.context.get('change_quantity_reason',
False)
res['origin'] = context
if self.preset_reason_id:
res['preset_reason_id'] = self.preset_reason_id.id
return res

View File

@@ -0,0 +1,17 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class StockInventoryLineReason(models.Model):
_name = 'stock.inventory.line.reason'
name = fields.Char('Reason Name')
description = fields.Text('Reason Description')
active = fields.Boolean(default=True)
_sql_constraints = [
('name_unique', 'UNIQUE(name)',
'You cannot have two reason with the same name.'),
]

View File

@@ -0,0 +1,10 @@
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
class StockMove(models.Model):
_inherit = "stock.move"
preset_reason_id = fields.Many2one('stock.inventory.line.reason',
required=False)

View File

@@ -0,0 +1,15 @@
To enable preset reason feature, you must:
- Go to: Inventory > Settings > Inventory Adjustment
- Enable: Preset Change Qty Reason
- Enable: Technical Settings > Manage Stock Change Qty Preset Reasons
Once is activate you will require te add a Preset reason to validate stock
products change quantity.
To allow an Stock Manager configure preset reasons easily, you should:
- Select Stock Manager user on: Settings > Users
- Enable: Technical Settings > Manage Stock Change Qty Preset Reasons
- Go to Inventory > Configuration > Inventory Adjustment > Change Qty Reasons

View File

@@ -1,3 +1,4 @@
* Denis Roussel <denis.roussel@acsone.eu>
* Meyomesse Gilles <meyomesse.gilles@gmail.com>
* Andreas Dian S.P <andreasdian777@gmail.com>
* Héctor Villarreal <hector.villarreal@eficent.com>

View File

@@ -1,2 +1,5 @@
This module extends the product stock management and allows to set a reason
in the wizard when changing the product quantity.
in the wizard when changing the product quantity or in inventory adjustments
per line.
It also can manage preset reasons optionally.

View File

@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_inventory_line_reason_user,stock.inventory.line.reason,model_stock_inventory_line_reason,stock.group_stock_user,1,0,0,0
access_stock_inventory_line_reason_manager,stock.inventory.line.reason,model_stock_inventory_line_reason,stock.group_stock_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_stock_inventory_line_reason_user stock.inventory.line.reason model_stock_inventory_line_reason stock.group_stock_user 1 0 0 0
3 access_stock_inventory_line_reason_manager stock.inventory.line.reason model_stock_inventory_line_reason stock.group_stock_manager 1 1 1 1

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="group_qty_reason_preset" model="res.groups">
<field name="name">Manage Stock Change Qty Preset Reasons</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
</odoo>

View File

@@ -369,21 +369,41 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_change_qty_reason"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-stock_change_qty_reason"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the product stock management and allows to set a reason
in the wizard when changing the product quantity.</p>
in the wizard when changing the product quantity or in inventory adjustments
per line.</p>
<p>It also can manage preset reasons optionally.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>To enable preset reason feature, you must:</p>
<ul class="simple">
<li>Go to: Inventory &gt; Settings &gt; Inventory Adjustment</li>
<li>Enable: Preset Change Qty Reason</li>
<li>Enable: Technical Settings &gt; Manage Stock Change Qty Preset Reasons</li>
</ul>
<p>Once is activate you will require te add a Preset reason to validate stock
products change quantity.</p>
<p>To allow an Stock Manager configure preset reasons easily, you should:</p>
<ul class="simple">
<li>Select Stock Manager user on: Settings &gt; Users</li>
<li>Enable: Technical Settings &gt; Manage Stock Change Qty Preset Reasons</li>
<li>Go to Inventory &gt; Configuration &gt; Inventory Adjustment &gt; Change Qty Reasons</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
@@ -391,23 +411,24 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Denis Roussel &lt;<a class="reference external" href="mailto:denis.roussel&#64;acsone.eu">denis.roussel&#64;acsone.eu</a>&gt;</li>
<li>Meyomesse Gilles &lt;<a class="reference external" href="mailto:meyomesse.gilles&#64;gmail.com">meyomesse.gilles&#64;gmail.com</a>&gt;</li>
<li>Andreas Dian S.P &lt;<a class="reference external" href="mailto:andreasdian777&#64;gmail.com">andreasdian777&#64;gmail.com</a>&gt;</li>
<li>Héctor Villarreal &lt;<a class="reference external" href="mailto:hector.villarreal&#64;eficent.com">hector.villarreal&#64;eficent.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose

View File

@@ -1,5 +1,6 @@
# pylint: disable=import-error,protected-access,too-few-public-methods
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
@@ -12,9 +13,11 @@ class TestStockQuantityChangeReason(SavepointCase):
super(TestStockQuantityChangeReason, cls).setUpClass()
# MODELS
cls.stock_move = cls.env['stock.move']
cls.product_product_model = cls.env['product.product']
cls.product_category_model = cls.env['product.category']
cls.wizard_model = cls.env['stock.change.product.qty']
cls.preset_reason_id = cls.env['stock.inventory.line.reason']
# INSTANCES
cls.category = cls.product_category_model.create({
@@ -26,12 +29,23 @@ class TestStockQuantityChangeReason(SavepointCase):
'categ_id': self.category.id,
'type': 'product'})
def _product_change_qty(self, product, new_qty, reason):
wizard = self.wizard_model.create({'product_id': product.id,
'new_quantity': new_qty,
'reason': reason})
def _product_change_qty(self, product, new_qty, reason,
preset_reason_id=None):
values = {
'product_id': product.id,
'new_quantity': new_qty,
'reason': reason,
}
if preset_reason_id:
values.update({'preset_reason_id': preset_reason_id.id})
wizard = self.wizard_model.create(values)
wizard.change_product_qty()
def _create_reason(self, name, description=None):
return self.preset_reason_id.create({
'name': name,
'description': description})
def test_product_change_qty(self):
""" Check product quantity update move reason is well set
"""
@@ -51,19 +65,42 @@ class TestStockQuantityChangeReason(SavepointCase):
self._product_change_qty(product6, 0, 'product_6_reason')
# check stock moves created
move2 = self.env['stock.move'].search([('product_id', '=',
product2.id)])
move3 = self.env['stock.move'].search([('product_id', '=',
product3.id)])
move4 = self.env['stock.move'].search([('product_id', '=',
product4.id)])
move5 = self.env['stock.move'].search([('product_id', '=',
product5.id)])
move6 = self.env['stock.move'].search([('product_id', '=',
product6.id)])
move2 = self.stock_move.search([('product_id', '=',
product2.id)])
move3 = self.stock_move.search([('product_id', '=',
product3.id)])
move4 = self.stock_move.search([('product_id', '=',
product4.id)])
move5 = self.stock_move.search([('product_id', '=',
product5.id)])
move6 = self.stock_move.search([('product_id', '=',
product6.id)])
self.assertEqual(move2.origin, 'product_2_reason')
self.assertFalse(move3)
self.assertFalse(move4)
self.assertEqual(move5.origin, 'product_5_reason')
self.assertFalse(move6)
def test_product_change_qty_with_preset_reason(self):
""" Check product quantity update move reason is well set
"""
# create reason
reason = self._create_reason('Test', 'Description Test')
# create products
product2 = self._create_product('product_product_2')
product3 = self._create_product('product_product_3')
# update qty on hand and add reason
self._product_change_qty(product2, 10, reason.name, reason)
self._product_change_qty(product3, 0, reason.name, reason)
# check stock moves created
move2 = self.stock_move.search([('product_id', '=',
product2.id)])
move3 = self.stock_move.search([('product_id', '=',
product3.id)])
# asserts
self.assertEqual(move2.origin, reason.name)
self.assertEqual(move2.preset_reason_id, reason)
self.assertFalse(move3)

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="qty_reason_preset_selection" model="ir.ui.view">
<field name="name">Select qty_reason_preset config parameter</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="stock.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='production_lot_info']" position='after'>
<h2>Inventory Adjustment</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_qty_reason_preset"/>
</div>
<div class="o_setting_right_pane">
<label for="group_qty_reason_preset"/>
<div class="text-muted">
Manage predefined change quantity reasons
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_preset_reason" model="ir.ui.view">
<field name="name">Preset Reason</field>
<field name="model">stock.inventory.line.reason</field>
<field name="arch" type="xml">
<form string="Preset Reason">
<header>
</header>
<sheet>
<div class="oe_button_box" name="active_button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group>
<field name="name"/>
<field name="description"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_change_qty_reasons_list" model="ir.actions.act_window">
<field name="name">Change Qty Reasons</field>
<field name="res_model">stock.inventory.line.reason</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">list,form</field>
</record>
<menuitem id="menu_inventory_adjustments_config" name="Inventory Adjustment" parent="stock.menu_stock_config_settings" groups="stock.group_stock_manager" sequence="5"/>
<menuitem id="menu_reasons" name="Change Qty Reasons" parent="menu_inventory_adjustments_config" groups="stock_change_qty_reason.group_qty_reason_preset" action="action_change_qty_reasons_list" sequence="1"/>
</odoo>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="reason_stock_inventory_line_tree" model="ir.ui.view">
<field name="name">stock.inventory.line.tree</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="stock.stock_inventory_line_tree"/>
<field name="arch" type="xml">
<field name="location_id" position="before">
<field name="reason"/>
</field>
</field>
</record>
<record id="reason_stock_inventory_line_tree_reason_id" model="ir.ui.view">
<field name="name">stock.inventory.line.tree.reason.code</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="reason_stock_inventory_line_tree"/>
<field name="groups_id" eval="[(4, ref('stock_change_qty_reason.group_qty_reason_preset'))]"/>
<field name="arch" type="xml">
<field name="reason" position="replace">
<field name="preset_reason_id"/>
</field>
</field>
</record>
<record id="reason_stock_inventory_line_tree2" model="ir.ui.view">
<field name="name">stock.inventory.line.tree</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="stock.stock_inventory_line_tree2"/>
<field name="arch" type="xml">
<field name="location_id" position="before">
<field name="reason"/>
</field>
</field>
</record>
<record id="reason_stock_inventory_line_tree2_reason_id" model="ir.ui.view">
<field name="name">stock.inventory.line.tree.reason.code</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="reason_stock_inventory_line_tree2"/>
<field name="groups_id" eval="[(4, ref('stock_change_qty_reason.group_qty_reason_preset'))]"/>
<field name="arch" type="xml">
<field name="reason" position="replace">
<field name="preset_reason_id"/>
</field>
</field>
</record>
<record id="view_inventory_form" model="ir.ui.view">
<field name="name">stock.inventory.form.inherit</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']/tree/field[@name='location_id']" position="after">
<field name="reason"/>
</xpath>
<xpath expr="//field[@name='line_ids']/kanban/field[@name='location_id']" position="after">
<field name="reason"/>
</xpath>
</field>
</record>
<record id="view_inventory_form_reason_id" model="ir.ui.view">
<field name="name">stock.inventory.form.inherit.reason.code</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="view_inventory_form"/>
<field name="groups_id" eval="[(4, ref('stock_change_qty_reason.group_qty_reason_preset'))]"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']/tree/field[@name='reason']" position="replace">
<field name="preset_reason_id"/>
</xpath>
<xpath expr="//field[@name='line_ids']/kanban/field[@name='reason']" position="replace">
<field name="preset_reason_id"/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,18 +1,16 @@
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
"""stock_change_product_qty"""
from odoo import models, fields, api
from odoo import api, fields, models
class StockChangeProductQty(models.TransientModel):
"""Class to inherit model stock.change.product.qty"""
_inherit = 'stock.change.product.qty'
reason = fields.Char('Reason',
help='Type in a reason for the '
'product quantity change')
reason = fields.Char(help='Type in a reason for the '
'product quantity change')
preset_reason_id = fields.Many2one('stock.inventory.line.reason')
@api.multi
def change_product_qty(self):
@@ -21,3 +19,17 @@ class StockChangeProductQty(models.TransientModel):
this = self.with_context(change_quantity_reason=self.reason)
return super(StockChangeProductQty, this).change_product_qty()
return super(StockChangeProductQty, self).change_product_qty()
def _action_start_line(self):
res = super(StockChangeProductQty, self)._action_start_line()
if self.preset_reason_id:
res.update({'preset_reason_id': self.preset_reason_id.id,
'reason': self.preset_reason_id.name})
elif self.reason:
res.update({'reason': self.reason})
return res
@api.onchange('preset_reason_id')
def onchange_preset_reason_id(self):
if self.preset_reason_id:
self.reason = self.preset_reason_id.name

View File

@@ -1,17 +1,31 @@
<!-- Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
Copyright 2019 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record id="view_change_product_quantity_reason" model="ir.ui.view">
<field name="name">Change Product Quantity Reason</field>
<field name="model">stock.change.product.qty</field>
<field name="inherit_id" ref="stock.view_change_product_quantity"/>
<field name="arch" type="xml">
<field name="new_quantity" position="after">
<field name="reason" attrs="{'required':True}"/>
</field>
<record id="view_change_product_quantity_reason" model="ir.ui.view">
<field name="name">Change Product Quantity Reason</field>
<field name="model">stock.change.product.qty</field>
<field name="inherit_id" ref="stock.view_change_product_quantity"/>
<field name="arch" type="xml">
<field name="new_quantity" position="after">
<field name="reason"/>
</field>
</record>
</data>
</field>
</record>
<record id="view_change_product_quantity_reason_id" model="ir.ui.view">
<field name="name">Change Product Quantity Reason</field>
<field name="model">stock.change.product.qty</field>
<field name="inherit_id" ref="view_change_product_quantity_reason"/>
<field name="groups_id" eval="[(4, ref('stock_change_qty_reason.group_qty_reason_preset'))]"/>
<field name="arch" type="xml">
<field name="reason" position="replace">
<field name="preset_reason_id" required="True"/>
</field>
</field>
</record>
</odoo>