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:
@@ -36,5 +36,5 @@ Immediately usable is computed : Quantity on Hand - Outgoing Stock.
|
||||
"data": ["product_view.xml",
|
||||
],
|
||||
"active": False,
|
||||
'installable': False
|
||||
'installable': True
|
||||
}
|
||||
@@ -24,38 +24,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
|
||||
|
||||
@@ -11,20 +11,24 @@
|
||||
<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" />
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<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">
|
||||
@@ -1,25 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<record model="ir.ui.view" id="product_template_form_view_reservation_button">
|
||||
<field name="name">product.template.reservation.button</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button class="oe_inline oe_stat_button" name="action_view_reservations"
|
||||
type="object" groups="base.group_sale_salesman" icon="fa-lock">
|
||||
<field string="Stock Reservations" name="reservation_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="product_product_form_view_reservation_button">
|
||||
<field name="name">product.template.reservation.button</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button class="oe_inline oe_stat_button" name="action_view_reservations"
|
||||
|
||||
Reference in New Issue
Block a user