[IMP] remove fill inventory wizard and improved view.

bzr revid: tpa@tinyerp.com-20130829112827-ywcklnhz0p6fxi4a
This commit is contained in:
Turkesh Patel (Open ERP) 2013-08-29 16:58:27 +05:30
parent 8970296df0
commit 8794b51ec0
6 changed files with 26 additions and 125 deletions

View File

@ -69,7 +69,6 @@ Dashboard / Reports for Warehouse Management will include:
'stock_data.xml',
'wizard/stock_move_view.xml',
'wizard/stock_change_product_qty_view.xml',
'wizard/stock_fill_inventory_view.xml',
'wizard/stock_inventory_merge_view.xml',
'wizard/stock_location_product_view.xml',
'wizard/stock_inventory_line_split_view.xml',

View File

@ -1784,7 +1784,7 @@ class stock_inventory(osv.osv):
#TODO test
self.action_cancel_draft(cr, uid, ids, context=context)
def _prepare_inventory(self, cr, uid, ids, full_of_zeros=False, context=None):
def prepare_inventory(self, cr, uid, ids, context=None):
inventory_line_obj = self.pool.get('stock.inventory.line')
for inventory in self.browse(cr, uid, ids, context=context):
#clean the existing inventory lines before redoing an inventory proposal
@ -1793,8 +1793,6 @@ class stock_inventory(osv.osv):
#compute the inventory lines and create them
vals = self._get_inventory_lines(cr, uid, inventory, context=context)
for product_line in vals:
if full_of_zeros:
product_line['product_qty'] = 0
inventory_line_obj.create(cr, uid, product_line, context=context)
return self.write(cr, uid, ids, {'state': 'confirm'})
@ -1843,7 +1841,7 @@ class stock_inventory_line(osv.osv):
'company_id': fields.related('inventory_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, select=True, readonly=True),
'prod_lot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
'state': fields.related('inventory_id', 'state', type='char', string='Status', readonly=True),
'real_qty':fields.related('product_id','qty_available', type='float', string='Real Quantity', store=True),
'real_qty':fields.related('product_id','qty_available', type='float', string='Real Quantity'),
}
def _resolve_inventory_line(self, cr, uid, inventory_line, theorical_lines, context=None):

View File

@ -101,16 +101,13 @@
<field name="arch" type="xml">
<form string="Physical Inventory" version="7.0">
<header>
<button name="%(action_view_stock_fill_inventory)d" states="draft" string="Start Inventory" type="action" class="oe_highlight" groups="stock.group_stock_user"/>
<button name="prepare_inventory" states="draft" string="Start 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,done"/>
</header>
<sheet>
<div class="oe_right oe_button_box">
<button name="action_check" string="Check Inventory Adjustments" states="draft,confirm" type="object" />
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name" placeholder="e.g. Annual inventory"/></h1>
@ -118,48 +115,40 @@
<group>
<group>
<field name="location_id"/>
</group>
<group>
<field name="date"/>
</group>
<div class="oe_grey" colspan="4">Specify filters to focus your inventory a on particular product, lot, pack and products owner</div>
<group>
<field name="product_id"/>
<field name="lot_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group>
<field name="date"/>
<field name="partner_id"/>
<field name="package_id"/>
</group>
</group>
<field name="move_ids_exist" invisible="1"/>
<notebook>
<page string="Inventory Details" attrs="{'invisible':[('state','=','draft')]}">
<button name="set_checked_qty" states="confirm" icon="gtk-go-forward" string="Set Checked Quantity to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
<field name="line_ids" string="Inventory Details">
<tree string="Inventory Details" editable="bottom" colors="blue: product_qty != real_qty">
<field context="{'location':location_id, 'uom':product_uom_id, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom_id,parent.date)" domain="[('type','=','product')]"/>
<field name="real_qty" readonly="1"/>
<field name="product_qty" string="Checked Quantity"/>
<field name="product_uom_id" groups="product.group_uom"/>
<field name="prod_lot_id"/>
<field name="package_id" readonly="1"/>
<field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations"/>
<field name="state" invisible="True"/>
</tree>
</field>
</page>
<page string="Inventory Adjustments" attrs="{'invisible': [('move_ids_exist', '=', False)],'invisible': [('state','=','draft')] }">
<field name="move_ids" context="{'inventory_id':active_id}" readonly="1">
<tree string="Inventory Adjustments">
<field name="product_id"/>
<field name="lot_ids"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="state" invisible="True"/>
</tree>
</field>
</page>
<notebook attrs="{'invisible':[('state','=','draft')]}">
<page string="Inventory Details" >
<button name="set_checked_qty" states="confirm" icon="gtk-go-forward" string="Set Checked Quantity to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
<field name="line_ids" string="Inventory Details">
<tree string="Inventory Details" editable="bottom" colors="blue: product_qty != real_qty">
<field context="{'location':location_id, 'uom':product_uom_id, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom_id,parent.date)" domain="[('type','=','product')]"/>
<field name="real_qty" readonly="1"/>
<field name="product_qty" string="Checked Quantity"/>
<field name="product_uom_id" groups="product.group_uom"/>
<field name="prod_lot_id"/>
<field name="package_id" readonly="1"/>
<field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations"/>
<field name="state" invisible="True"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</sheet>
</form>
</field>
</record>

View File

@ -21,7 +21,6 @@
import stock_move
import stock_inventory_merge
import stock_fill_inventory
import stock_inventory_line_split
import stock_location_product
import stock_return_picking

View File

@ -1,51 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
class stock_fill_inventory(osv.osv_memory):
_name = "stock.fill.inventory"
_description = "Import Inventory"
_columns = {
'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"),
}
def fill_inventory(self, cr, uid, ids, context=None):
""" To Import stock inventory according to products available in the selected locations.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
if context is None:
context = {}
inventory_obj = self.pool.get('stock.inventory')
if ids and len(ids):
ids = ids[0]
fill_inventory = self.browse(cr, uid, ids, context=context)
inventory_obj._prepare_inventory(cr, uid, context.get('active_ids', []), fill_inventory.set_stock_zero, context=context)
return {'type': 'ir.actions.act_window_close'}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_stock_fill_inventory" model="ir.ui.view">
<field name="name">Import Inventory</field>
<field name="model">stock.fill.inventory</field>
<field name="arch" type="xml">
<form string="Import Inventory" version="7.0">
<separator string="Import the current inventory"/>
<group>
<field name="set_stock_zero"/>
</group>
<footer>
<button name="fill_inventory" string="Fill Inventory" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<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>
</record>
</data>
</openerp>