Skip to content

Commit

Permalink
[MIG] stock_quant_reserved_qty_uom to v10
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisRForgeFlow committed Mar 17, 2017
1 parent e4db12d commit dd63d09
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 36 deletions.
5 changes: 1 addition & 4 deletions stock_quant_reserved_qty_uom/README.rst
Expand Up @@ -9,14 +9,12 @@ Stock Quant Reserved Qty UoM
This module allows to display the quantity of a quant in the unit of measure
defined in the reservation move.


Usage
=====

.. 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/9.0

:target: https://runbot.odoo-community.org/runbot/153/10.0

Bug Tracker
===========
Expand All @@ -39,7 +37,6 @@ Contributors

* Jordi Ballester Alomar <jordi.ballester@eficent.com>


Maintainer
----------

Expand Down
Expand Up @@ -4,7 +4,7 @@

{
'name': 'Stock Quant Reserved Qty UoM',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Inventory, Logistic, Storage',
'license': 'AGPL-3',
"author": "Eficent, "
Expand Down
9 changes: 3 additions & 6 deletions stock_quant_reserved_qty_uom/models/stock_quant.py
Expand Up @@ -2,24 +2,21 @@
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import api, fields, models
import openerp.addons.decimal_precision as dp
from odoo import api, fields, models
import odoo.addons.decimal_precision as dp

UNIT = dp.get_precision('Product Unit of Measure')


class StockQuant(models.Model):

_inherit = 'stock.quant'

@api.multi
@api.depends('qty', 'reservation_id')
def _compute_reserved_qty_uom(self):
uom_obj = self.env['product.uom']
for rec in self:
if rec.reservation_id:
rec.reserved_qty_uom = uom_obj._compute_qty_obj(
rec.product_id.uom_id,
rec.reserved_qty_uom = rec.product_id.uom_id._compute_quantity(
rec.qty,
rec.reservation_id.product_uom)

Expand Down
Expand Up @@ -2,7 +2,7 @@
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase


class TestStockQuantReservedQtyUom(TransactionCase):
Expand Down
49 changes: 25 additions & 24 deletions stock_quant_reserved_qty_uom/views/stock_quant_view.xml
@@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<record model="ir.ui.view" id="view_stock_quant_tree">
<field name="name">stock.quant.tree</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<field name="reservation_id" position="after">
<field name="reserved_qty_uom"/>
<field name="reservation_uom" groups="product.group_uom"/>
</field>
<odoo>

<record model="ir.ui.view" id="view_stock_quant_tree">
<field name="name">stock.quant.tree</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<field name="reservation_id" position="after">
<field name="reserved_qty_uom"/>
<field name="reservation_uom" groups="product.group_uom"/>
</field>
</record>
</field>
</record>

<record model="ir.ui.view" id="view_stock_quant_form">
<field name="name">stock.quant.form</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_form"/>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<field name="reservation_id" position="after">
<field name="reserved_qty_uom"/>
<field name="reservation_uom" groups="product.group_uom"/>
</field>
<record model="ir.ui.view" id="view_stock_quant_form">
<field name="name">stock.quant.form</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_form"/>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<field name="reservation_id" position="after">
<field name="reserved_qty_uom"/>
<field name="reservation_uom" groups="product.group_uom"/>
</field>
</record>
</field>
</record>

</openerp>
</odoo>

0 comments on commit dd63d09

Please sign in to comment.