[MIG] stock_available_unreserved

This commit is contained in:
Stefan Rijnhart
2017-05-15 09:46:10 +02:00
committed by Lois Rilo
parent ecab13d267
commit d79518b979
6 changed files with 18 additions and 21 deletions

View File

@@ -23,7 +23,7 @@ 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
@@ -46,6 +46,7 @@ Contributors
------------
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Stefan Rijnhart <stefan@opener.amsterdam>
Maintainer

View File

@@ -5,8 +5,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Available Unreserved",
"summary": "Quantity of stock available for inmediate use",
"version": "9.0.1.0.0",
"summary": "Quantity of stock available for immediate use",
"version": "10.0.1.0.0",
"author": "Eficent Business and IT Consulting Services S.L,"
"Odoo Community Association (OCA)",
"website": "https://www.odoo-community.org",

View File

@@ -4,9 +4,9 @@
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models, _
from openerp.tools.float_utils import float_round
from openerp.addons import decimal_precision as dp
from odoo import api, fields, models, _
from odoo.tools.float_utils import float_round
from odoo.addons import decimal_precision as dp
UNIT = dp.get_precision('Product Unit of Measure')
@@ -38,9 +38,7 @@ class ProductTemplate(models.Model):
prod_available = super(ProductTemplate, self)._product_available(name,
arg)
variants = self.env['product.product']
for product in self:
variants += product.product_variant_ids
variants = self.mapped('product_variant_ids')
variant_available = variants._product_available()
for product in self:
@@ -60,8 +58,8 @@ class ProductTemplate(models.Model):
@api.multi
def action_open_quants_unreserved(self):
products = self._get_products()
result = self._get_act_window_dict('stock.product_open_quants')
products = self.mapped('product_variant_ids').ids
result = self.env.ref('stock.product_open_quants').read()[0]
result['domain'] = "[('product_id','in',[" + ','.join(
map(str, products)) + "]), ('reservation_id', '=', False)]"
result[
@@ -93,7 +91,7 @@ class ProductProduct(models.Model):
def _prepare_domain_available_not_res(self, products):
domain_products = [('product_id', 'in', products.mapped('id'))]
domain_quant = []
domain_quant_loc, _, _ = products._get_domain_locations()
domain_quant_loc = products._get_domain_locations()[0]
domain_quant += domain_products

View File

@@ -5,7 +5,7 @@
# Copyright 2016 Therp BV <http://therp.nl>
# 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 TestStockLogisticsWarehouse(TransactionCase):
@@ -134,3 +134,5 @@ class TestStockLogisticsWarehouse(TransactionCase):
pickingOutA.action_done()
compare_qty_available_not_res(productB, 1)
compare_qty_available_not_res(templateAB, 3)
templateAB.action_open_quants_unreserved()

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="view_stock_product_template_tree" model="ir.ui.view">
@@ -74,5 +73,4 @@
</field>
</record>
</data>
</openerp>
</odoo>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="quant_search_view" model="ir.ui.view">
<field name="name">stock.quant.search</field>
@@ -27,5 +26,4 @@
<field name="res_model">stock.quant</field>
</record>
</data>
</openerp>
</odoo>