mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[9.0][MIG] stock_manual_assign: Migration to 9.0
* Fix uom issue * Convert move quantity in the default product uom to use the same uom as quant
This commit is contained in:
committed by
Tony Gu
parent
1fa8988ea2
commit
a3480babb7
@@ -2,23 +2,24 @@
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
===========================
|
||||
Manual assignment of quants
|
||||
===========================
|
||||
===============================
|
||||
Stock - Manual Quant Assignment
|
||||
===============================
|
||||
|
||||
With this module, user can manually change the automatic selection of quants.
|
||||
This module allows you to manually change the automatic quant selection.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
* You will able to select the quants from each stock.move. There will be a
|
||||
button that opens a wizard directly from the move or from the picking.
|
||||
#. Select a stock move or a stock picking.
|
||||
#. Open the wizard with the button "Manual Quants".
|
||||
#. Select the quants to assign (reserve).
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/153/8.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/9.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
@@ -26,12 +27,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/stock-logistics-warehouse/issues>`_. 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 `feedback
|
||||
<https://github.com/OCA/
|
||||
stock-logistics-warehouse/issues/new?body=module:%20
|
||||
stock_quant_manual_assign%0Aversion:%20
|
||||
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
{
|
||||
"name": "Stock - Manual assignment of quants",
|
||||
"version": "8.0.1.0.0",
|
||||
"name": "Stock - Manual Quant Assignment",
|
||||
"version": "9.0.1.0.0",
|
||||
"category": "Warehouse Management",
|
||||
"license": "AGPL-3",
|
||||
"author": "OdooMRP team, "
|
||||
@@ -12,12 +12,6 @@
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "http://www.odoomrp.com",
|
||||
"contributors": [
|
||||
"Mikel Arregi <mikelarregi@avanzosc.es>",
|
||||
"Ana Juaristi Olalde <anajuaristi@avanzosc.es>",
|
||||
"Pedro Manuel Baeza Romero <pedro.baeza@serviciosbaeza.com>"
|
||||
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
|
||||
],
|
||||
"depends": [
|
||||
"stock",
|
||||
],
|
||||
@@ -25,5 +19,5 @@
|
||||
"wizard/assign_manual_quants_view.xml",
|
||||
"views/stock_move_view.xml",
|
||||
],
|
||||
"installable": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -1,36 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="stock_move_manual_quants_form_view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_done" position="after">
|
||||
<button name="%(assign_manual_quants_action)d" type="action"
|
||||
string="Manual Quants" class="oe_highlight"
|
||||
attrs="{'invisible':['|',('picking_type_code','=','incoming'),('state','not in',('confirmed','assigned'))]}"/>
|
||||
</button>
|
||||
<field name="picking_type_id" position="after">
|
||||
<field name="picking_type_code" invisible="1" />
|
||||
</field>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="stock_move_manual_quants_form_view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="before">
|
||||
<button name="%(assign_manual_quants_action)d" type="action"
|
||||
string="Manual Quants" class="oe_highlight"
|
||||
attrs="{'invisible':['|',('picking_type_code','=','incoming'),('state','not in',('confirmed','assigned'))]}"/>
|
||||
</field>
|
||||
</record>
|
||||
<field name="picking_type_id" position="after">
|
||||
<field name="picking_type_code" invisible="1" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="stock_move_manual_quants_picking_form_view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<button name="force_assign" position="after">
|
||||
<button name="%(assign_manual_quants_action)d" type="action"
|
||||
string="Manual Quants" class="oe_highlight"
|
||||
attrs="{'invisible':['|',('picking_type_code','=','incoming'),('state','not in',('confirmed','assigned'))]}" />
|
||||
</button>
|
||||
<field name="picking_type_id" position="after">
|
||||
<field name="picking_type_code" invisible="1" />
|
||||
</field>
|
||||
<record model="ir.ui.view" id="stock_move_manual_quants_picking_form_view">
|
||||
<field name="name">stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="before">
|
||||
<button name="%(assign_manual_quants_action)d" type="action"
|
||||
string="Manual Quants" class="oe_highlight"
|
||||
attrs="{'invisible':['|',('picking_type_code','=','incoming'),('state','not in',('confirmed','assigned'))]}" />
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
<field name="picking_type_id" position="after">
|
||||
<field name="picking_type_code" invisible="1" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -17,7 +17,9 @@ class AssignManualQuants(models.TransientModel):
|
||||
if record.quants_lines:
|
||||
move = self.env['stock.move'].browse(
|
||||
self.env.context['active_id'])
|
||||
if record.lines_qty > move.product_uom_qty:
|
||||
move_qty = self.env['product.uom']._compute_qty_obj(
|
||||
move.product_uom, move.product_uom_qty, move.product_id.uom_id)
|
||||
if record.lines_qty > move_qty:
|
||||
raise exceptions.Warning(
|
||||
_('Quantity is higher than the needed one'))
|
||||
|
||||
@@ -26,7 +28,9 @@ class AssignManualQuants(models.TransientModel):
|
||||
move = self.env['stock.move'].browse(self.env.context['active_id'])
|
||||
lines_qty = sum(self.quants_lines.mapped('qty'))
|
||||
self.lines_qty = lines_qty
|
||||
self.move_qty = move.product_uom_qty - lines_qty
|
||||
move_qty = self.env['product.uom']._compute_qty_obj(
|
||||
move.product_uom, move.product_uom_qty, move.product_id.uom_id)
|
||||
self.move_qty = move_qty - lines_qty
|
||||
|
||||
name = fields.Char(string='Name')
|
||||
lines_qty = fields.Float(
|
||||
@@ -52,8 +56,8 @@ class AssignManualQuants(models.TransientModel):
|
||||
return {}
|
||||
|
||||
@api.model
|
||||
def default_get(self, var_fields):
|
||||
super(AssignManualQuants, self).default_get(var_fields)
|
||||
def default_get(self, fields):
|
||||
res = super(AssignManualQuants, self).default_get(fields)
|
||||
move = self.env['stock.move'].browse(self.env.context['active_id'])
|
||||
available_quants = self.env['stock.quant'].search([
|
||||
('location_id', 'child_of', move.location_id.id),
|
||||
@@ -71,7 +75,9 @@ class AssignManualQuants(models.TransientModel):
|
||||
'qty': x.qty if x in move.reserved_quant_ids else 0,
|
||||
'location_id': x.location_id.id,
|
||||
} for x in available_quants]
|
||||
return {'quants_lines': quants_lines}
|
||||
res.update({'quants_lines': quants_lines})
|
||||
res = self._convert_to_write(self._convert_to_cache(res))
|
||||
return res
|
||||
|
||||
|
||||
class AssignManualQuantsLines(models.TransientModel):
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="assign_manual_quants_form_view">
|
||||
<field name="name">assign.manual.quants.form</field>
|
||||
<field name="model">assign.manual.quants</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Manual Quants">
|
||||
<group col='4' colspan="4">
|
||||
<field name='quants_lines' colspan="4">
|
||||
<tree editable="top" delete="0" create="0">
|
||||
<field name="quant" />
|
||||
<field name="location_id" />
|
||||
<field name="lot_id" />
|
||||
<field name="package_id" />
|
||||
<field name="selected" />
|
||||
<field name="qty" attrs="{'readonly':[('selected', '=' ,False)]}" sum="qty"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="move_qty" colspan="2" readonly="1"/>
|
||||
<field name="lines_qty" invisible="1" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="assign_quants" type="object"
|
||||
string="Confirm" class="oe_highlight" />
|
||||
or
|
||||
<button string="Cancel" class="oe_link"
|
||||
special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="assign_manual_quants_form_view">
|
||||
<field name="name">assign.manual.quants.form</field>
|
||||
<field name="model">assign.manual.quants</field>
|
||||
<field name="arch" type="xml">
|
||||
<form name="Manual Quants">
|
||||
<group col='4' colspan="4">
|
||||
<field name='quants_lines' colspan="4">
|
||||
<tree editable="top" delete="0" create="0">
|
||||
<field name="quant" />
|
||||
<field name="location_id" />
|
||||
<field name="lot_id" />
|
||||
<field name="package_id" />
|
||||
<field name="selected" />
|
||||
<field name="qty" attrs="{'readonly':[('selected', '=' ,False)]}" sum="qty"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="move_qty" colspan="2" readonly="1"/>
|
||||
<field name="lines_qty" invisible="1" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="assign_quants" type="object"
|
||||
string="Confirm" class="oe_highlight" />
|
||||
<button name="cancel" string="Cancel" class="oe_link"
|
||||
special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Manual quants" res_model="assign.manual.quants"
|
||||
src_model="stock.move" view_mode="form" target="new"
|
||||
id="assign_manual_quants_action" />
|
||||
</data>
|
||||
</openerp>
|
||||
<act_window name="Manual quants" res_model="assign.manual.quants"
|
||||
src_model="stock.move" view_mode="form" target="new"
|
||||
id="assign_manual_quants_action" />
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user