[MERGE] stock improvements & fixes

bzr revid: fp@tinyerp.com-20120918171020-u9yrlmxui2v9ow3a
This commit is contained in:
Fabien Pinckaers 2012-09-18 19:10:20 +02:00
commit 4dad07b8bb
17 changed files with 275 additions and 149 deletions

View File

@ -30,7 +30,9 @@ Create a claim from a delivery order.
Adds a Claim link to the delivery order.
""",
'data' : ['claim_delivery_view.xml'],
'data' : [
'claim_delivery_view.xml',
'claim_delivery_data.xml',],
'auto_install': False,
'installable': True,
'certificate' : '001101649349223746957',

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="res.request.link" id="request_link_claim_from_delivery">
<field name="name">Delivery Order</field>
<field name="object">stock.picking.out</field>
</record>
</data>
</openerp>

View File

@ -1,11 +1,27 @@
<openerp>
<data>
<act_window id="action_claim_from_delivery" name="Claim"
domain="[]" target="current"
context="{'default_partner_id': partner_id}"
view_mode="form" res_model="crm.claim"
src_model="stock.picking" />
<record id="action_claim_from_delivery" model="ir.actions.act_window">
<field name="name">Claim From Delivery</field>
<field name="res_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_claim.crm_case_claims_tree_view"/>
<field name="context">{'default_ref': 'stock.picking.out,'+str(context.get('active_id', False))}</field>
<field name="domain">[('ref','=','stock.picking.out,'+str(context.get('active_id',False)))]</field>
</record>
<record id="crm_claim_from_delivery" model="ir.ui.view">
<field name="name">crm.claim.from_delivery.form</field>
<field name="model">stock.picking.out</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/h1" position="before">
<div class="oe_right oe_button_box">
<button name="%(action_claim_from_delivery)d" string="Claims" type="action"/>
</div>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -259,10 +259,10 @@
<record id="view_picking_withweight_internal_move_form" model="ir.ui.view">
<field name="name">stock.picking_withweight.internal.move.form.view</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_tree"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page/field[@name='move_lines']/tree/field[@name='product_uom']" position="after">
<xpath expr="//field[@name='product_uom']" position="after">
<field name="weight"/>
<field name="weight_net" groups="base.group_no_one"/>
</xpath>
@ -306,7 +306,7 @@
<record id="view_delivery_order_inherit_stock" model="ir.ui.view">
<field name="name">stock.picking.out.form</field>
<field name="model">stock.picking</field>
<field name="model">stock.picking.out</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<xpath expr="/form/header//button[@string='Create Invoice/Refund']" position="after">

View File

@ -30,7 +30,8 @@
icon="terp-graph"
id="menu_board_manufacturing"
parent="base.menu_reporting_dashboard"
sequence="30"/>
sequence="30"
groups="group_mrp_manager"/>
</data>
</openerp>

View File

@ -554,7 +554,7 @@ class stock_warehouse_orderpoint(osv.osv):
'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','!=','service')]),
'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True),
'product_min_qty': fields.float('Minimum Quantity', required=True,
help="When the virtual stock goes below the Min Quantity specified for this field, OpenERP generates "\

View File

@ -548,6 +548,7 @@ class purchase_order(osv.osv):
'partner_id': order.dest_address_id.id or order.partner_id.id,
'move_dest_id': order_line.move_dest_id.id,
'state': 'draft',
'type':'in',
'purchase_line_id': order_line.id,
'company_id': order.company_id.id,
'price_unit': order_line.price_unit

View File

@ -31,7 +31,7 @@
<field name="purchase_id"/>
</xpath>
<xpath expr="//field[@name='company_id']" position="after">
<field name="warehouse_id"/>
<field name="warehouse_id" groups="stock.group_locations"/>
</xpath>
</field>
</record>

View File

@ -883,6 +883,7 @@ class sale_order(osv.osv):
'sale_line_id': line.id,
'tracking_id': False,
'state': 'draft',
'type':'out',
#'state': 'waiting',
'note': '\n'.join(line.name.split('\n')[1:]),
'company_id': order.company_id.id,

View File

@ -9,9 +9,6 @@
<field name="move_type" position="before">
<field name="sale_id"/>
</field>
<label for="partner_id" position="replace">
<label for="partner_id" class="oe_edit_only" string="Contact"/>
</label>
</field>
</record>

View File

@ -61,7 +61,7 @@
parent="base.menu_reporting_dashboard"
action="open_board_warehouse"
sequence="25"
groups="group_stock_manager"/>
groups="stock.group_stock_user"/>
</data>
</openerp>

View File

@ -6,7 +6,8 @@
id="stock.next_id_61"
name="Warehouse"
sequence="15"
parent="base.menu_reporting"/>
parent="base.menu_reporting"
groups="group_stock_manager"/>
<record id="view_stock_tree" model="ir.ui.view">
<field name="name">report.stock.move.tree</field>

View File

@ -21,11 +21,11 @@ access_stock_production_lot_manager,stock.production.lot manager,model_stock_pro
access_stock_production_lot_user,stock.production.lot user,model_stock_production_lot,stock.group_stock_user,1,1,1,1
access_stock_production_lot_revision,stock.production.lot.revision,model_stock_production_lot_revision,stock.group_stock_user,1,1,1,1
access_stock_move_manager,stock.move manager,model_stock_move,stock.group_stock_manager,1,1,0,0
access_stock_move_user,stock.move user,model_stock_move,stock.group_stock_user,1,0,0,0
access_stock_move_user,stock.move user,model_stock_move,stock.group_stock_user,1,1,1,0
access_stock_move_warehouse_manager,stock.move.manager,model_stock_move,stock.group_stock_manager,1,1,1,1
access_stock_inventory_user,stock.inventory user,model_stock_inventory,stock.group_stock_user,1,0,0,0
access_stock_inventory_user,stock.inventory user,model_stock_inventory,stock.group_stock_user,1,1,1,0
access_stock_inventory_manager,stock.inventory manager,model_stock_inventory,stock.group_stock_manager,1,1,1,1
access_stock_inventory_line_user,stock.inventory.line user,model_stock_inventory_line,stock.group_stock_user,1,0,0,0
access_stock_inventory_line_user,stock.inventory.line user,model_stock_inventory_line,stock.group_stock_user,1,1,1,0
access_stock_inventory_line_manager,stock.inventory.line manager,model_stock_inventory_line,stock.group_stock_manager,1,1,1,1
access_stock_report_prodlots,stock.report.prodlots,model_stock_report_prodlots,stock.group_stock_manager,1,0,0,0
access_stock_location_sale_manager,stock.location sale manager,model_stock_location,base.group_sale_manager,1,0,0,0
@ -61,3 +61,4 @@ access_product_group_res_partner_stock_manager,res_partner group_stock_manager,b
access_product_pricelist_version_stock_manager,product.pricelist.version stock_manager,product.model_product_pricelist_version,stock.group_stock_manager,1,1,1,1
access_product_pricelist_item_stock_manager,product.pricelist.item stock_manager,product.model_product_pricelist_item,stock.group_stock_manager,1,1,1,1
access_account_account_stock_manager,account.account stock manager,account.model_account_account,stock.group_stock_manager,1,0,0,0
access_board_stock_user,board.board user,board.model_board_board,stock.group_stock_user,1,1,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
21 access_stock_production_lot_user stock.production.lot user model_stock_production_lot stock.group_stock_user 1 1 1 1
22 access_stock_production_lot_revision stock.production.lot.revision model_stock_production_lot_revision stock.group_stock_user 1 1 1 1
23 access_stock_move_manager stock.move manager model_stock_move stock.group_stock_manager 1 1 0 0
24 access_stock_move_user stock.move user model_stock_move stock.group_stock_user 1 0 1 0 1 0
25 access_stock_move_warehouse_manager stock.move.manager model_stock_move stock.group_stock_manager 1 1 1 1
26 access_stock_inventory_user stock.inventory user model_stock_inventory stock.group_stock_user 1 0 1 0 1 0
27 access_stock_inventory_manager stock.inventory manager model_stock_inventory stock.group_stock_manager 1 1 1 1
28 access_stock_inventory_line_user stock.inventory.line user model_stock_inventory_line stock.group_stock_user 1 0 1 0 1 0
29 access_stock_inventory_line_manager stock.inventory.line manager model_stock_inventory_line stock.group_stock_manager 1 1 1 1
30 access_stock_report_prodlots stock.report.prodlots model_stock_report_prodlots stock.group_stock_manager 1 0 0 0
31 access_stock_location_sale_manager stock.location sale manager model_stock_location base.group_sale_manager 1 0 0 0
61 access_product_pricelist_version_stock_manager product.pricelist.version stock_manager product.model_product_pricelist_version stock.group_stock_manager 1 1 1 1
62 access_product_pricelist_item_stock_manager product.pricelist.item stock_manager product.model_product_pricelist_item stock.group_stock_manager 1 1 1 1
63 access_account_account_stock_manager account.account stock manager account.model_account_account stock.group_stock_manager 1 0 0 0
64 access_board_stock_user board.board user board.model_board_board stock.group_stock_user 1 1 0 0

View File

@ -1659,6 +1659,7 @@ class stock_move(osv.osv):
# used for colors in tree views:
'scrapped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scrapped', readonly=True),
'type': fields.related('picking_id', 'type', type='selection', selection=[('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], string='Shipping Type'),
}
def _check_location(self, cr, uid, ids, context=None):
for record in self.browse(cr, uid, ids, context=context):
@ -1738,10 +1739,25 @@ class stock_move(osv.osv):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.company_id.partner_id.id
def _default_move_type(self, cr, uid, context=None):
""" Gets default type of move
@return: type
"""
if context is None:
context = {}
picking_type = context.get('picking_type')
type = 'internal'
if picking_type == 'in':
type = 'in'
elif picking_type == 'out':
type = 'out'
return type
_defaults = {
'location_id': _default_location_source,
'location_dest_id': _default_location_destination,
'partner_id': _default_destination_address,
'type': _default_move_type,
'state': 'draft',
'priority': '1',
'product_qty': 1.0,
@ -1895,6 +1911,32 @@ class stock_move(osv.osv):
result['location_dest_id'] = loc_dest_id
return {'value': result}
def onchange_move_type(self, cr, uid, ids, type, context=None):
""" On change of move type gives sorce and destination location.
@param type: Move Type
@return: Dictionary of values
"""
mod_obj = self.pool.get('ir.model.data')
location_source_id = False
location_dest_id = False
if type == 'in':
location_source_id = 'stock_location_suppliers'
location_dest_id = 'stock_location_stock'
elif type == 'out':
location_source_id = 'stock_location_stock'
location_dest_id = 'stock_location_customers'
if location_source_id:
try:
location_model, location_source_id = mod_obj.get_object_reference(cr, uid, 'stock', location_source_id)
except ValueError, e:
location_source_id = False
if location_dest_id:
try:
location_model, location_dest_id = mod_obj.get_object_reference(cr, uid, 'stock', location_dest_id)
except ValueError, e:
location_dest_id = False
return {'value':{'location_id': location_source_id, 'location_dest_id': location_dest_id}}
def onchange_date(self, cr, uid, ids, date, date_expected, context=None):
""" On change of Scheduled Date gives a Move date.
@param date_expected: Scheduled Date

View File

@ -106,13 +106,16 @@
<field name="arch" type="xml">
<form string="Physical Inventory" version="7.0">
<header>
<button name="action_confirm" states="draft" string="Confirm Inventory" type="object" class="oe_highlight"/>
<button name="action_done" states="confirm" string="Validate Inventory" type="object" class="oe_highlight"/>
<button name="action_confirm" states="draft" string="Confirm Inventory" type="object" class="oe_highlight" groups="stock.group_stock_user"/>
<button name="action_done" states="confirm" string="Validate Inventory" type="object" class="oe_highlight" groups="stock.group_stock_manager"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_cancel_inventory" states="draft,confirm,done" string="Cancel Inventory" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
</header>
<sheet>
<div class="oe_right oe_button_box">
<button name="%(action_view_stock_fill_inventory)d" string="Fill Inventory" type="action" />
</div>
<group>
<group>
<field name="name" placeholder="e.g. Annual inventory"/>
@ -231,9 +234,9 @@
<field name="active"/>
</group>
<group groups="stock.group_tracking_lot" string="Traceability">
<button name="action_traceability" icon="gtk-go-up" string="Upstream Traceability" type="object"
<button name="action_traceability" string="Upstream Traceability" type="object"
colspan="2"/>
<button name="action_traceability" icon="gtk-go-down" string="Downstream Traceability" type="object"
<button name="action_traceability" string="Downstream Traceability" type="object"
context="{'type': 'move_history_ids'}" colspan="2"/>
</group>
</group>
@ -334,8 +337,8 @@
<field name="arch" type="xml">
<form string="Serial Number" version="7.0">
<div class="oe_button_box oe_right">
<button name="action_traceability" string="Upstream Traceability" type="object" context="{'type': '', 'field': 'prodlot_id'}" icon="gtk-go-up"/>
<button name="action_traceability" string="Downstream Traceability" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}" icon="gtk-go-down"/>
<button name="action_traceability" string="Upstream Traceability" type="object" context="{'type': 'move_history_ids2', 'field': 'prodlot_id'}"/>
<button name="action_traceability" string="Downstream Traceability" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -759,15 +762,10 @@
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" class="oe_inline"/>
<span attrs="{'invisible': [('origin','=',False)]}"> - </span>
<field name="origin" placeholder="e.g. PO0032" class="oe_inline"/>
</h1>
<label for="partner_id" class="oe_edit_only"/>
<h2>
<field name="partner_id" on_change="onchange_partner_in(partner_id)"/>
</h2>
<group>
<group>
<field name="partner_id" on_change="onchange_partner_in(partner_id)"/>
<field name="backorder_id" readonly="1"/>
<field name="invoice_state" string="Invoice Control" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
<field name="stock_journal_id" widget="selection" groups="account.group_account_user"/>
@ -775,119 +773,23 @@
<group>
<field name="date"/>
<field name="min_date" readonly="1"/>
<field name="origin" placeholder="e.g. PO0032" class="oe_inline"/>
</group>
</group>
<notebook>
<page string="Products">
<field name="move_lines" context="{'address_in_id': partner_id}">
<tree colors="grey:scrapped == True" string="Stock Moves">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="product_uos" groups="product.group_uos"/>
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
<field name="scrapped" invisible="1"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button
name="%(stock.track_line)d"
string="Split in Serial Number"
groups="stock.group_production_lot"
type="action" icon="terp-stock_effects-object-colorize"
states="draft,waiting,confirmed,assigned"/>
<field groups="stock.group_tracking_lot" name="tracking_id"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
icon="terp-stock_effects-object-colorize"
groups="stock.group_tracking_lot"
states="draft,assigned,confirmed"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="product.group_stock_packaging"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="state"/>
</tree>
<form string="Stock Moves" version="7.0">
<header>
<span groups="base.group_user">
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/>
</span>
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done"/>
</header>
<group>
<group>
<field name="name" invisible="1"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<label for="product_qty"/>
<div>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" class="oe_inline"/>
<field name="product_uom" string="Unit Of Measure" groups="product.group_uom" class="oe_inline"/>
<button name="%(stock.move_scrap)d"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
</div>
<label for="product_uos_qty" groups="product.group_uos"/>
<div groups="product.group_uos">
<field name="product_uos_qty" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" class="oe_inline"/>
<field name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" class="oe_inline"/>
</div>
<field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]"/>
</group>
<group>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group string="Locations" groups="stock.group_locations">
<field name="location_id" domain="[('usage','&lt;&gt;','view')]"/>
<field name="location_dest_id" domain="[('usage','=','internal')]" groups="stock.group_locations"/>
</group>
<group groups="stock.group_tracking_lot" string="Traceability">
<label for="tracking_id"/>
<div>
<field name="tracking_id" groups="stock.group_tracking_lot" class="oe_inline"/>
<button name="%(split_into)d" string="New Pack" type="action"
groups="product.group_stock_packaging"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed"/>
</div>
<label for="prodlot_id"/>
<div>
<field name="prodlot_id" groups="stock.group_production_lot"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id, product_uom)" class="oe_inline"/>
<button name="%(track_line)d"
groups="stock.group_tracking_lot"
states="draft,waiting,confirmed,assigned"
string="Split" type="action" icon="terp-stock_effects-object-colorize"/>
</div>
</group>
</group>
</form>
</field>
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>
</page>
<page string="Additional Info">
<group>
<group>
<field name="move_type"/>
<field name="type" groups="base.group_user"/>
<field name="type" groups="base.group_no_one"/>
<field name="auto_picking" groups="base.group_user"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date_done"/>
<field name="date_done" groups="base.group_no_one"/>
</group>
</group>
</page>
@ -972,7 +874,7 @@
<record id="view_picking_out_tree" model="ir.ui.view">
<field name="name">stock.picking.out.tree</field>
<field name="model">stock.picking</field>
<field name="model">stock.picking.out</field>
<field name="arch" type="xml">
<tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Delivery Orders">
<field name="name"/>
@ -1002,7 +904,7 @@
<button name="action_assign" states="confirmed" string="Check Availability" type="object" class="oe_highlight"/>
</xpath>
<xpath expr="/form/header//button[@name='action_process']" position="replace">
<button name="action_process" states="assigned" string="Deliver" type="object" icon="gtk-go-forward" class="oe_highlight"/>
<button name="action_process" states="assigned" string="Deliver" type="object" class="oe_highlight"/>
</xpath>
<xpath expr="/form/header//field[@name='state']" position="replace">
<field name="state" nolabel="1" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
@ -1010,6 +912,9 @@
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4" string="Customer"/>
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_in_id': partner_id, 'picking_type': 'out', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_chatter">
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
@ -1133,6 +1038,9 @@
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4" string="Supplier"/>
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_chatter">
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
@ -1207,7 +1115,7 @@
</record>
<menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="1"/>
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2"/>
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2" groups="stock.group_locations"/>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">stock.move.tree</field>
@ -1218,6 +1126,7 @@
<field name="name"/>
<field name="picking_id" string="Reference"/>
<field name="origin"/>
<field name="type" on_change="onchange_move_type(type)"/>
<field name="create_date" invisible="1" groups="base.group_no_one"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -1251,6 +1160,45 @@
</field>
</record>
<record id="view_move_picking_tree" model="ir.ui.view">
<field name="name">stock.move.tree</field>
<field name="model">stock.move</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:scrapped == True" string="Stock Moves">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="product_uos" groups="product.group_uos"/>
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
<field name="scrapped" invisible="1"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button
name="%(stock.track_line)d"
string="Split in Serial Number"
groups="stock.group_production_lot"
type="action" icon="terp-stock_effects-object-colorize"
states="draft,waiting,confirmed,assigned"/>
<field groups="stock.group_tracking_lot" name="tracking_id"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
icon="terp-stock_effects-object-colorize"
groups="stock.group_tracking_lot"
states="draft,assigned,confirmed"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
groups="product.group_stock_packaging"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="view_move_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
@ -1292,6 +1240,7 @@
</group>
<group name="origin_grp" string="Origin">
<field name="picking_id"/>
<field name="type" on_change="onchange_move_type(type)"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="create_date" groups="base.group_no_one"/>
</group>
@ -1329,6 +1278,81 @@
</field>
</record>
<record id="view_move_picking_form" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Stock Moves" version="7.0">
<header>
<span groups="base.group_user">
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="action_confirm" states="draft" string="Confirm" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/>
</span>
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done"/>
</header>
<group>
<group>
<field name="name" invisible="1"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
<field name="type" invisible="1"/>
<label for="product_qty"/>
<div>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" class="oe_inline"/>
<field name="product_uom" string="Unit Of Measure" groups="product.group_uom" class="oe_inline"/>
<button name="%(stock.move_scrap)d"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
</div>
<label for="product_uos_qty" groups="product.group_uos"/>
<div groups="product.group_uos">
<field name="product_uos_qty" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" class="oe_inline"/>
<field name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" class="oe_inline"/>
</div>
<field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]"/>
</group>
<group>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group string="Locations" groups="stock.group_locations">
<field name="location_id" domain="[('usage','&lt;&gt;','view')]"/>
<field name="location_dest_id" domain="[('usage','=','internal')]" groups="stock.group_locations"/>
</group>
<group groups="stock.group_tracking_lot" string="Traceability">
<label for="tracking_id"/>
<div>
<field name="tracking_id" groups="stock.group_tracking_lot" class="oe_inline"/>
<button name="%(split_into)d"
string="New Pack" type="action"
groups="product.group_stock_packaging"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed"/>
</div>
<label for="prodlot_id"/>
<div>
<field name="prodlot_id" groups="stock.group_production_lot"
context="{'location_id':location_id, 'product_id':product_id}"
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id, product_uom)" class="oe_inline"/>
<button name="%(track_line)d"
groups="stock.group_tracking_lot"
states="draft,waiting,confirmed,assigned"
string="Split" type="action" icon="terp-stock_effects-object-colorize"/>
</div>
</group>
</group>
</form>
</field>
</record>
<record id="view_move_search" model="ir.ui.view">
<field name="name">stock.move.search</field>
<field name="model">stock.move</field>
@ -1380,6 +1404,21 @@
</p>
</field>
</record>
<record model="ir.actions.act_window.view" id="action_stock_move_tree_all">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_move_tree"/>
<field name="act_window_id" ref="action_move_form2"/>
</record>
<record model="ir.actions.act_window.view" id="action_stock_move_form_all">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_move_form"/>
<field name="act_window_id" ref="action_move_form2"/>
</record>
<menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="3"/>
<!--
@ -1453,7 +1492,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'product_receive\' : True, \'default_location_id\':%d, \'default_location_dest_id\':%d, \'search_default_future\': 1}' % (ref('stock_location_suppliers'),ref('stock_location_stock') )"/>
<field name="context">{'product_receive': True, 'search_default_future': True, 'picking_type': 'in'}</field>
<field name="help" type="html">
<p>
Click to register a product reception.
@ -1588,7 +1627,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','out')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'default_location_id\':%d, \'default_location_dest_id\':%d, \'search_default_future\': 1}' % (ref('stock_location_stock'),ref('stock_location_customers'))"/>
<field name="context">{'picking_type': 'out', 'search_default_future': True}</field>
<field name="help" type="html">
<p>
You will find in this list all products you have to deliver to

View File

@ -25,11 +25,23 @@ from tools.translate import _
class stock_fill_inventory(osv.osv_memory):
_name = "stock.fill.inventory"
_description = "Import Inventory"
def _default_location(self, cr, uid, ids, context=None):
try:
loc_model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
except ValueError, e:
return False
return location_id or False
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
'recursive': fields.boolean("Include children",help="If checked, products contained in child locations of selected location will be included as well."),
'set_stock_zero': fields.boolean("Set to zero",help="If checked, all product quantities will be set to zero to help ensure a real physical inventory is done"),
}
_defaults = {
'location_id': _default_location,
}
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.

View File

@ -8,8 +8,8 @@
<form string="Import Inventory" version="7.0">
<separator string="Import current product inventory from the following location"/>
<group>
<field name="location_id"/>
<field name="recursive"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="recursive" groups="stock.group_locations"/>
<field name="set_stock_zero"/>
</group>
<footer>
@ -21,14 +21,16 @@
</field>
</record>
<act_window name="Import Inventory"
res_model="stock.fill.inventory"
src_model="stock.inventory"
view_mode="form"
target="new"
context="{'search_default_in_location':1}"
key2="client_action_multi"
id="action_view_stock_fill_inventory"/>
<record id="action_view_stock_fill_inventory" model="ir.actions.act_window">
<field name="name">Fill Inventory</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.fill.inventory</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_stock_fill_inventory"/>
<field name="target">new</field>
<field name="context">{'search_default_in_location':1}</field>
</record>
</data>
</openerp>