[IMP]: stock: Improvment in wizards for putting it properly on right side, removed _ from function called from button

bzr revid: rpa@tinyerp.com-20100310092511-mmkho4c4w2g2ql7f
This commit is contained in:
rpa (Open ERP) 2010-03-10 14:55:11 +05:30
parent d6eb52eb5e
commit 1fe8691588
14 changed files with 74 additions and 72 deletions

View File

@ -42,7 +42,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"demo_xml" : ["stock_demo.xml"],
"update_xml" : [
"stock_data.xml",
"wizard/inventory_merge_stock_zero_view.xml",
"wizard/stock_inventory_set_stock_zero_view.xml",
"wizard/stock_fill_inventory_view.xml",
"wizard/stock_invoice_onshipping_view.xml",
"wizard/stock_location_product_view.xml",

View File

@ -33,9 +33,12 @@
<field name="product_uom"/>
<field name="prod_lot_id"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines"
type="action" icon="gtk-justify-fill"/>
<!-- <button name="%(split_inventory_lots)d"
string="Split Inventory Lines" type="action"
icon="gtk-justify-fill" /> -->
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines"
type="action" icon="gtk-justify-fill"/>
</form>
</field>
</record>
@ -110,16 +113,6 @@
<button name="action_done" states="draft" string="Confirm Inventory" type="object" icon="gtk-apply"/>
<button name="action_cancel" states="cancel" string="Set to Draft" type="object" icon="gtk-cancel"/>
<button name="action_cancel_inventary" states="draft" string="Cancel Inventory" type="object" icon="gtk-cancel"/>
<group col="4" colspan="2">
<button name="%(stock.action_view_inventory_merge_stock_zero)d"
string="Set Stock to Zero"
type="action"/>
<button name="%(stock.action_view_stock_fill_inventory)d"
string="Fill Inventory"
type="action"/>
</group>
</group>
</form>
@ -429,9 +422,6 @@
</group>
<separator string="Additional Information" colspan="4"/>
<field colspan="4" name="comment" nolabel="1"/>
<button name="%(stock.action_view_stock_location_product)d"
string="Products by Location"
type="action"/>
</form>
</field>
</record>
@ -919,9 +909,6 @@
<field name="state"/>
<button name="%(partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Picking"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the picking. Do you want to continue?"/>
<button name="%(wizard_invoice_onshipping)d" states="done" string="Invoice" type="action"
icon="gtk-execute" help="Create invoice"
attrs="{'invisible': [('invoice_state', '!=', '2binvoiced')]}" />
</tree>
</field>
</record>

View File

@ -43,20 +43,6 @@
name="stock.return.picking"
string="Return picking"/>
<wizard
id="wizard_invoice_onshipping"
keyword="client_action_multi"
model="stock.picking"
name="stock.invoice_onshipping"
string="Create invoice"/>
<wizard
string="Set Stock to 0"
model="stock.inventory"
name="inventory.merge.stock.zero"
keyword="client_action_multi"
id="wizard_merge_inventory_zero"/>
<wizard
string="Merge inventories"
model="stock.inventory"
@ -65,19 +51,5 @@
multi="True"
id="wizard_merge_inventory"/>
<wizard
string="Fill Inventory"
model="stock.inventory"
name="stock.fill_inventory"
keyword="client_action_multi"
id="wizard_fill_inventory"
/>
<wizard
id="location_product"
model="stock.location"
name="stock.location.products"
string="Products by Location"/>
</data>
</openerp>

View File

@ -29,7 +29,7 @@ import wizard_split_lot_line
import wizard_ups
import inventory_merge
import inventory_merge_stock_zero
import stock_inventory_set_stock_zero
import stock_fill_inventory
import stock_inventory_line_split
import stock_invoice_onshipping

View File

@ -33,25 +33,26 @@ class stock_fill_inventory(osv.osv_memory):
_name = "stock.fill.inventory"
_description = "Fill Inventory"
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
'recursive': fields.boolean("Include all childs for the location"),
'location_id': fields.many2one('stock.location', 'Location', required=True),
'recursive': fields.boolean("Include all childs for the location"),
}
def _fill_inventory(self, cr, uid, ids, context):
def fill_inventory(self, cr, uid, ids, context):
inventory_line_obj = self.pool.get('stock.inventory.line')
location_obj = self.pool.get('stock.location')
for fill_inventory in self.browse(cr, uid, ids):
res = {}
res_location = {}
if fill_inventory.recursive :
location_ids = location_obj.search(cr, uid, [('location_id',
location_ids = location_obj.search(cr, uid, [('location_id',
'child_of', fill_inventory.location_id.id)])
for location in location_ids :
res = location_obj._product_get(cr, uid, location)
res_location[location] = res
else:
context.update({'compute_child': False})
res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context)
res = location_obj._product_get(cr, uid,
fill_inventory.location_id.id, context=context)
res_location[fill_inventory.location_id.id] = res
product_ids = []
@ -61,21 +62,21 @@ class stock_fill_inventory(osv.osv_memory):
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
uom = prod.uom_id.id
context.update({'uom': uom})
amount = self.pool.get('stock.location')._product_get(cr, uid,
amount = self.pool.get('stock.location')._product_get(cr, uid,
location, [product_id], context=context)[product_id]
if(amount):
line_ids=inventory_line_obj.search(cr, uid,
[('inventory_id', '=', context['active_ids']),
('location_id', '=', location),
('product_id', '=', product_id),
('product_uom', '=', uom),
line_ids=inventory_line_obj.search(cr, uid,
[('inventory_id', '=', context['active_ids']),
('location_id', '=', location),
('product_id', '=', product_id),
('product_uom', '=', uom),
('product_qty', '=', amount)])
if not len(line_ids):
inventory_line = {'inventory_id': context['active_ids'][0],
'location_id': location,
'product_id': product_id,
'product_uom': uom,
inventory_line = {'inventory_id': context['active_ids'][0],
'location_id': location,
'product_id': product_id,
'product_uom': uom,
'product_qty': amount}
inventory_line_obj.create(cr, uid, inventory_line)
product_ids.append(product_id)

View File

@ -14,7 +14,7 @@
<newline/>
<separator string="" colspan="4" />
<button special="cancel" string="Cancel" />
<button name="_fill_inventory" string="Fill Inventory" type="object"/>
<button name="fill_inventory" string="Fill Inventory" type="object"/>
</form>
</field>
</record>
@ -29,5 +29,15 @@
<field name="context">{'record_id' : active_id}</field>
</record>
<record model="ir.values" id="wiki_stock_fill_inventory">
<field name="model_id" ref="stock.model_stock_inventory" />
<field name="object" eval="1" />
<field name="name">Fill Inventory</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_view_stock_fill_inventory'))" />
<field name="key">action</field>
<field name="model">stock.inventory</field>
</record>
</data>
</openerp>

View File

@ -49,7 +49,7 @@ inventory lines, make sure the production lot is assigned to this product.'))
'prefix': _check_production_lot,
}
def _split_lines(self, cr, uid, ids, context):
def split_lines(self, cr, uid, ids, context):
inv_id = context['active_id']
inv_line_obj = self.pool.get('stock.inventory.line')
prodlot_obj = self.pool.get('stock.production.lot')

View File

@ -13,7 +13,7 @@
<separator string="" colspan="4" />
<label string=""/>
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="_split_lines" string="Ok" type="object" icon="gtk-ok"/>
<button name="split_lines" string="Ok" type="object" icon="gtk-ok"/>
</form>
</field>
</record>

View File

@ -26,6 +26,17 @@
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'record_id' : active_id}</field>
</record>
<record model="ir.values" id="wiki_merge_stock_zero">
<field name="model_id" ref="stock.model_stock_inventory" />
<field name="object" eval="1" />
<field name="name">Set Stock to Zero</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_view_inventory_merge_stock_zero'))" />
<field name="key">action</field>
<field name="model">stock.inventory</field>
</record>
</data>

View File

@ -68,7 +68,7 @@ class stock_invoice_onshipping(osv.osv_memory):
'type': _get_type,
}
def _create_invoice(self, cr, uid, ids, context):
def create_invoice(self, cr, uid, ids, context):
result = []
for onshipdata_obj in self.read(cr, uid, ids, ['journal_id', 'group', 'type', 'invoice_date']):
if context.get('new_picking', False):

View File

@ -17,18 +17,29 @@
<field name="invoice_date" />
<separator string="" colspan="4" />
<button special="cancel" string="Cancel" />
<button name="_create_invoice" string="Create Invoices" type="object"/>
<button name="create_invoice" string="Create Invoices" type="object"/>
</form>
</field>
</record>
<record id="action_stock_invoice_onshipping" model="ir.actions.act_window">
<field name="name">Stock Invoice Onshipping</field>
<field name="name">Create Invoice</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.invoice.onshipping</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'record_id' : active_id}</field>
</record>
<record model="ir.values" id="stock_stock_invoice_onshipping">
<field name="model_id" ref="stock.model_stock_picking" />
<field name="object" eval="1" />
<field name="name">Create Invoice</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_stock_invoice_onshipping'))" />
<field name="key">action</field>
<field name="model">stock.picking</field>
</record>
</data>
</openerp>

View File

@ -36,7 +36,7 @@ class stock_location_product(osv.osv_memory):
'to_date': fields.datetime('To'),
}
def _action_open_window(self, cr, uid, ids, context):
def action_open_window(self, cr, uid, ids, context):
mod_obj = self.pool.get('ir.model.data')
for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']):
result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')

View File

@ -17,7 +17,7 @@
<separator string="" colspan="4" />
<label string=""/>
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="_action_open_window" string="Open Product" type="object" icon="gtk-ok"/>
<button name="action_open_window" string="Open Product" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
@ -29,7 +29,17 @@
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'record_id' : active_id}</field>
</record>
<record model="ir.values" id="stock_location_product">
<field name="model_id" ref="stock.model_stock_location" />
<field name="object" eval="1" />
<field name="name">Products by Location</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_view_stock_location_product'))" />
<field name="key">action</field>
<field name="model">stock.location</field>
</record>
</data>
</openerp>