mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[UPD] move out from unported to 8 for update
[UPG] Upgraded to version 8, fixed references to new 8.0 views and moved fields that were in product.product to product.template [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [UPG] stock available immediately, corrected the calculation method of immediately_usable_qty to take in accountthe sign change in outgoing_qty (from negative to positive) in version 8. [FLAKE8] [FIX] renaming of a class, comment removing, useless code. [UPD] move out from unported to 8 for update [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [FIX] renaming of a class, comment removing, useless code. [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [UPD] move out from unported to 8 for update [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [FIX] renaming of a class, comment removing, useless code. [UPD] move out from unported to 8 for update [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [FIX] renaming of a class, comment removing, useless code. [UPD] move out from unported to 8 for update [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [FIX] renaming of a class, comment removing, useless code. [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [UPD] move out from unported to 8 for update [fix] remove duplicate view and correct view name [UPG][FIX] added outgoing field XML, that was in the base stock field in 7.0. [FIX] renaming of a class, comment removing, useless code.
This commit is contained in:
committed by
Florian da Costa
parent
90e656934a
commit
860db2bd89
@@ -36,5 +36,5 @@ Immediately usable is computed : Quantity on Hand - Outgoing Stock.
|
||||
"data": ["product_view.xml",
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
'installable': True
|
||||
}
|
||||
|
||||
@@ -20,42 +20,24 @@
|
||||
##############################################################################
|
||||
|
||||
from openerp.addons import decimal_precision as dp
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class product_immediately_usable(orm.Model):
|
||||
class ProductTemplate(orm.Model):
|
||||
"""
|
||||
Inherit Product in order to add an "immediately usable quantity"
|
||||
stock field
|
||||
Immediately usable quantity is : real stock - outgoing qty
|
||||
"""
|
||||
_inherit = 'product.product'
|
||||
_inherit = 'product.template'
|
||||
|
||||
def _product_available(self, cr, uid, ids, field_names=None,
|
||||
arg=False, context=None):
|
||||
"""
|
||||
Get super() _product_available and compute immediately_usable_qty
|
||||
"""
|
||||
# We need available and outgoing quantities to compute
|
||||
# immediately usable quantity.
|
||||
# When immediately_usable_qty is displayed but
|
||||
# not qty_available and outgoing_qty,
|
||||
# they are not computed in the super method so we cannot
|
||||
# compute immediately_usable_qty.
|
||||
# To avoid this issue, we add the 2 fields in
|
||||
# field_names to compute them.
|
||||
if 'immediately_usable_qty' in field_names:
|
||||
field_names.append('qty_available')
|
||||
field_names.append('outgoing_qty')
|
||||
|
||||
res = super(product_immediately_usable, self)._product_available(
|
||||
res = super(ProductTemplate, self)._product_available(
|
||||
cr, uid, ids, field_names, arg, context)
|
||||
|
||||
if 'immediately_usable_qty' in field_names:
|
||||
for product_id, stock_qty in res.iteritems():
|
||||
res[product_id]['immediately_usable_qty'] = \
|
||||
stock_qty['qty_available'] + stock_qty['outgoing_qty']
|
||||
stock_qty['qty_available'] - stock_qty['outgoing_qty']
|
||||
|
||||
return res
|
||||
|
||||
@@ -137,6 +119,6 @@ class product_immediately_usable(orm.Model):
|
||||
type='float',
|
||||
string='Immediately Usable',
|
||||
multi='qty_available',
|
||||
help="Quantity of products really available for sale." \
|
||||
help="Quantity of products really available for sale."
|
||||
"Computed as: Quantity On Hand - Outgoing."),
|
||||
}
|
||||
|
||||
@@ -11,9 +11,13 @@
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_normal_stock_active_qty_form">
|
||||
<field name="name">product.normal.stock.active.qty.form.inherit</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_template_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="virtual_available" position="before">
|
||||
<newline/>
|
||||
<field name="outgoing_qty" class="oe_inline"/>
|
||||
</field>
|
||||
<field name="virtual_available" position="after">
|
||||
<newline/>
|
||||
<field name="immediately_usable_qty" />
|
||||
@@ -23,8 +27,8 @@
|
||||
|
||||
<record model="ir.ui.view" id="product_product_tree_view">
|
||||
<field name="name">product_immediately_usable.product_product_tree_view</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_product_tree_view"/>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_product_template_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<tree position="attributes">
|
||||
|
||||
Reference in New Issue
Block a user