[ADD] stock: Added osv_memory wizard for 'Upstream Traceability' and 'Downstream Traceability' wizards.
bzr revid: mtr@mtr-20100326130416-e245kw4dr7eutedo
This commit is contained in:
@@ -50,6 +50,8 @@ Thanks to the double entry management, the inventory controlling is powerful and
|
||||
"wizard/stock_location_product_view.xml",
|
||||
"wizard/stock_inventory_line_split_view.xml",
|
||||
"wizard/stock_change_standard_price_view.xml",
|
||||
"wizard/stock_inventory_merge_view.xml",
|
||||
"wizard/stock_traceability_view.xml",
|
||||
"stock_workflow.xml",
|
||||
"stock_incoterms.xml",
|
||||
"stock_wizard.xml",
|
||||
|
||||
+10
-10
@@ -338,31 +338,31 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<wizard
|
||||
<!--wizard
|
||||
id="action_lot2"
|
||||
model="stock.production.lot"
|
||||
name="stock.traceability.lot.upstream"
|
||||
string="Upstream traceability"/>
|
||||
string="Upstream traceability"/-->
|
||||
|
||||
<wizard
|
||||
<!--wizard
|
||||
id="action_lot4"
|
||||
model="stock.production.lot"
|
||||
name="stock.traceability.lot.downstream"
|
||||
string="Downstream traceability"/>
|
||||
string="Downstream traceability"/-->
|
||||
|
||||
<wizard
|
||||
<!--wizard
|
||||
id="action4"
|
||||
model="stock.tracking"
|
||||
name="stock.traceability.upstream"
|
||||
string="Upstream traceability"/>
|
||||
string="Upstream traceability"/-->
|
||||
|
||||
<wizard
|
||||
<!--wizard
|
||||
id="action2"
|
||||
model="stock.tracking"
|
||||
name="stock.traceability.downstream"
|
||||
string="Downstream traceability"/>
|
||||
string="Downstream traceability"/-->
|
||||
|
||||
<record id="action3" model="ir.actions.act_window">
|
||||
<!--record id="action3" model="ir.actions.act_window">
|
||||
<field name="name">Downstream traceability</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
@@ -391,7 +391,7 @@
|
||||
<field name="name">Upstream traceability</field>
|
||||
<field eval="'ir.actions.act_window,'+str(action5)" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
</record-->
|
||||
|
||||
<record id="view_location_form" model="ir.ui.view">
|
||||
<field name="name">stock.location.form</field>
|
||||
|
||||
@@ -29,13 +29,11 @@ import wizard_return
|
||||
import wizard_split_lot_line
|
||||
import wizard_ups
|
||||
import inventory_merge
|
||||
|
||||
import stock_inventory_set_stock_zero
|
||||
import stock_fill_inventory
|
||||
import stock_inventory_line_split
|
||||
import stock_invoice_onshipping
|
||||
import stock_location_product
|
||||
|
||||
import stock_change_standard_price
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -23,63 +23,91 @@ import wizard
|
||||
import netsvc
|
||||
import time
|
||||
import pooler
|
||||
|
||||
from osv import osv
|
||||
|
||||
def action_traceability(type='move_history_ids', field='tracking_id'):
|
||||
def open_tab(self, cr, uid, data, context):
|
||||
obj = pooler.get_pool(cr.dbname).get('stock.move')
|
||||
ids = obj.search(cr, uid, [(field, 'in', data['ids'])])
|
||||
cr.execute('select id from ir_ui_view where model=%s and field_parent=%s and type=%s', ('stock.move', type, 'tree'))
|
||||
class action_traceability(osv.osv_memory):
|
||||
"""
|
||||
This class defines a function action_traceability for wizard
|
||||
|
||||
"""
|
||||
_name = "action.traceability"
|
||||
_description = "Action traceability "
|
||||
|
||||
def action_traceability(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
It traces the information of a product
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: A dictionary of values
|
||||
|
||||
"""
|
||||
type1 = context['type'] or 'move_history_ids'
|
||||
field = context['field'] or 'tracking_id'
|
||||
obj = self.pool.get('stock.move')
|
||||
ids = obj.search(cr, uid, [(field, 'in',context['active_ids'])])
|
||||
cr.execute('select id from ir_ui_view where model=%s and field_parent=%s and type=%s', ('stock.move', type1, 'tree'))
|
||||
view_id = cr.fetchone()[0]
|
||||
value = {
|
||||
'domain': "[('id','in',["+','.join(map(str, ids))+"])]",
|
||||
'name': ((type=='move_history_ids') and 'Upstream Traceability') or 'Downstream Traceability',
|
||||
'name': ((type1=='move_history_ids') and 'Upstream Traceability') or 'Downstream Traceability',
|
||||
'view_type': 'tree',
|
||||
'res_model': 'stock.move',
|
||||
'field_parent': type,
|
||||
'field_parent': type1,
|
||||
'view_id': (view_id,'View'),
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
}
|
||||
return value
|
||||
return open_tab
|
||||
|
||||
action_traceability()
|
||||
|
||||
class wiz_journal(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': action_traceability('move_history_ids2'), 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_journal('stock.traceability.downstream')
|
||||
class stock_traceability_downstream(osv.osv_memory):
|
||||
"""
|
||||
This class is defined for Stock traceability downstream wizard
|
||||
|
||||
class wiz_journal2(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': action_traceability(), 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_journal2('stock.traceability.upstream')
|
||||
"""
|
||||
_name = "stock.traceability.downstream"
|
||||
_inherit = "action.traceability"
|
||||
_description = "Stock traceability downstream"
|
||||
|
||||
stock_traceability_downstream()
|
||||
|
||||
class wiz_journal3(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': action_traceability(field='prodlot_id'), 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_journal3('stock.traceability.lot.upstream')
|
||||
class stock_traceability_upstream(osv.osv_memory):
|
||||
"""
|
||||
This class is defined for Stock traceability upstream wizard
|
||||
|
||||
class wiz_journal4(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': action_traceability('move_history_ids2', 'prodlot_id'), 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_journal4('stock.traceability.lot.downstream')
|
||||
"""
|
||||
_name = "stock.traceability.upstream"
|
||||
_inherit = "action.traceability"
|
||||
_description = "Stock traceability upstream"
|
||||
|
||||
stock_traceability_upstream()
|
||||
|
||||
class stock_traceability_lot_upstream(osv.osv_memory):
|
||||
"""
|
||||
This class is defined for Stock traceability lot upstream wizard
|
||||
|
||||
"""
|
||||
_name = "stock.traceability.lot.upstream"
|
||||
_inherit = "action.traceability"
|
||||
_description = "Stock traceability lot upstream"
|
||||
|
||||
stock_traceability_lot_upstream()
|
||||
|
||||
class stock_traceability_lot_downstream(osv.osv_memory):
|
||||
"""
|
||||
This class is defined for Stock traceability lot downstream wizard
|
||||
|
||||
"""
|
||||
_name = "stock.traceability.lot.downstream"
|
||||
_inherit = "action.traceability"
|
||||
_description = "Stock traceability lot downstream"
|
||||
|
||||
stock_traceability_lot_downstream()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- =========stock.traceability.downstream================= -->
|
||||
|
||||
<record id="view_stock_traceability_downstream" model="ir.ui.view">
|
||||
<field name="name">Stock traceability downstream</field>
|
||||
<field name="model">stock.traceability.downstream</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Downstream traceability">
|
||||
|
||||
<label string="It will give information about the stock of a product as per the Tracking Lot" colspan="2" />
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="action_traceability" string="Downstream traceability" type="object" context="{'type': 'move_history_ids2','field': ''}"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Downstream traceability"
|
||||
res_model="stock.traceability.downstream"
|
||||
src_model="stock.tracking"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_stock_traceability_downstream"/>
|
||||
|
||||
<!-- =========stock.traceability.upstream================= -->
|
||||
|
||||
<record id="view_stock_traceability_upstream" model="ir.ui.view">
|
||||
<field name="name">Stock traceability upstream</field>
|
||||
<field name="model">stock.traceability.upstream</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Upstream traceability">
|
||||
|
||||
<label string="It will give information about the stock of a product as per the Tracking Lot" colspan="2" />
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="action_traceability" string="Upstream traceability" type="object" context="{'type': '','field': ''}"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Upstream traceability"
|
||||
res_model="stock.traceability.upstream"
|
||||
src_model="stock.tracking"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_stock_traceability_upstream"/>
|
||||
|
||||
<!-- =========stock.traceability.lot.upstream================= -->
|
||||
|
||||
<record id="view_stock_traceability_lot_upstream" model="ir.ui.view">
|
||||
<field name="name">Stock traceability lot upstream</field>
|
||||
<field name="model">stock.traceability.lot.upstream</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stock traceability lot upstream">
|
||||
|
||||
<label string="It will give information about the stock of a product as per the Production Lot" colspan="2" />
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="action_traceability" string="Upstream traceability" type="object" context="{'type': '', 'field': 'prodlot_id'}"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Upstream traceability"
|
||||
res_model="stock.traceability.lot.upstream"
|
||||
src_model="stock.production.lot"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_stock_traceability_lot_upstream"/>
|
||||
|
||||
<!-- =========stock.traceability.lot.downstream================= -->
|
||||
|
||||
<record id="view_stock_traceability_lot_downstream" model="ir.ui.view">
|
||||
<field name="name">Stock traceability lot downstream</field>
|
||||
<field name="model">stock.traceability.lot.downstream</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Stock traceability lot downstream">
|
||||
|
||||
<label string="It will give information about the stock of a product as per the Production Lot" colspan="2" />
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="action_traceability" string="Downstream traceability" type="object" context="{'type': 'move_history_ids2', 'field': 'prodlot_id'}"/>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Downstream traceability"
|
||||
res_model="stock.traceability.lot.downstream"
|
||||
src_model="stock.production.lot"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_stock_traceability_lot_downstream"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user