[IMP] misc usability improvements

bzr revid: qdp-launchpad@openerp.com-20131108165217-wk9b079p7jladswm
This commit is contained in:
Quentin (OpenERP) 2013-11-08 17:52:17 +01:00
commit cd543d96e0
11 changed files with 201 additions and 127 deletions

View File

@ -134,7 +134,6 @@ class procurement_order(osv.osv):
('running', 'Running'),
('done', 'Done')
], 'Status', required=True, track_visibility='onchange'),
'message': fields.text('Latest error', help="Exception occurred while computing procurement orders.", track_visibility='onchange'),
}
_defaults = {

View File

@ -53,18 +53,15 @@
<field name="product_uos" class="oe_inline"/>
</div>
</group>
<group name="scheduling">
<group name="scheduling" string="Scheduling">
<field name="date_planned"/>
<field name="priority"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
</group>
<notebook>
<page string="Notes">
<label for="name" class="oe_edit_only"/>
<field name="name" placeholder="External note..."/>
<label for="message" class="oe_edit_only"/>
<field name="message"/>
</page>
<page string="Extra Information">
<group>
@ -74,6 +71,7 @@
</group>
<group>
<field name="rule_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
</group>
</page>
@ -145,13 +143,15 @@
<field name="context">{'search_default_current':1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a procurement order.
</p><p>
A procurement order is used to record a need for a specific
product at a specific location. Procurement orders are usually
created automatically from sales orders, pull logistic rules or
minimum stock rules.
</p><p>
Click to create a procurement order.
</p>
<p>
A <b>procurement order</b> is used to record a need for a specific
product at a specific location. Procurement orders are usually
created automatically from <i>sales orders, pull logistic rules or
minimum stock rules.</i>
</p>
<p>
When the procurement order is confirmed, it automatically
creates the necessary operations to fullfil the need: purchase
order proposition, manufacturing order, etc.
@ -168,9 +168,19 @@
<field name="context">{}</field>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="help" type="html">
<p>
Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sales Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the product configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, ordering products from a supplier, or passing a manufacturing order, etc. A Procurement Exception occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message).
</p>
<p class="oe_view_nocontent_create">
Click to create a Procurement.
</p>
<p>
<b>Procurement Orders</b> represent the need for a certain quantity of products, at a given time, in a given location.
</p>
<p>
<b>Sales Orders</b> are one typical source of Procurement Orders (but these are distinct documents).
<br/>Depending on the procurement parameters and the product configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, ordering products from a supplier, or passing a manufacturing order, etc...
</p>
<p>
A <b>Procurement Exception</b> occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message in the chatter).
</p>
</field>
</record>

View File

@ -239,6 +239,19 @@ class product_category(osv.osv):
res.append((record['id'], name))
return res
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if not context:
context = {}
if name:
# Be sure name_search is symetric to name_get
name = name.split(' / ')[-1]
ids = self.search(cr, uid, [('name', operator, name)] + args, limit=limit, context=context)
else:
ids = self.search(cr, uid, args, limit=limit, context=context)
return self.name_get(cr, uid, ids, context)
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
res = self.name_get(cr, uid, ids, context=context)
return dict(res)
@ -279,8 +292,6 @@ class product_category(osv.osv):
_constraints = [
(_check_recursion, 'Error ! You cannot create recursive categories.', ['parent_id'])
]
def child_get(self, cr, uid, ids):
return [ids]

View File

@ -13,7 +13,7 @@
<filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
<separator/>
<filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
<field name="categ_id"/>
<field name="categ_id" operator="child_of"/>
<group expand="0" string="Context...">
<field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
<field name="company_id" groups="base.group_multi_company"/>

View File

@ -197,7 +197,7 @@
<field name="date_order"/>
<field name="origin" attr="{'invisible': [('origin','=',False)]}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="picking_type_id" on_change="onchange_picking_type_id(picking_type_id, context)" domain="[('code_id','=','incoming')]" widget="selection"/>
<field name="picking_type_id" on_change="onchange_picking_type_id(picking_type_id, context)" domain="[('code_id','=','incoming')]" widget="selection" context="{'special_shortened_wh_name': True}"/>
<field name="related_location_id" invisible="1"/>
<field name="dest_address_id" string="Customer Address" on_change="onchange_dest_address_id(dest_address_id)"
attrs="{'invisible':['|', ('picking_type_id','=',False), ('related_location_id','!=', False)],
@ -347,7 +347,7 @@
<field name="name">Requests for Quotation</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="context">{'special_shortened_wh_name': True}</field>
<field name="context">{}</field>
<field name="domain">[('state','in',('draft','sent','bid','cancel', 'confirmed'))]</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="search_view_id" ref="view_purchase_order_filter"/>
@ -373,7 +373,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="context">{'special_shortened_wh_name': True}</field>
<field name="context">{}</field>
<field name="domain">[('state','not in',('draft','sent','bid', 'confirmed'))]</field>
<field name="search_view_id" ref="view_purchase_order_filter"/>
<field name="help" type="html">

View File

@ -15,7 +15,7 @@
<xpath expr="//button[@name='action_view_invoice']" position="after">
<field name="picking_ids" invisible="1"/>
<button name="action_view_delivery" string="View Delivery Order" type="object" class="oe_highlight"
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}" groups="base.group_user"/>
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual', 'done')),('shipped','=',True)]}" groups="base.group_user"/>
</xpath>
<xpath expr="//button[@name='action_cancel']" position="after">
<button name="ship_cancel" states="shipping_except" string="Cancel Order"/>

View File

@ -406,9 +406,10 @@ class procurement_order(osv.osv):
if qty <= 0:
continue
if op.product_id.type not in ('consu'):
if op.procurement_draft_ids:
procurement_draft_ids = orderpoint_obj.get_draft_procurements(cr, uid, op. id, context=context)
if procurement_draft_ids:
# Check draft procurement related to this order point
pro_ids = [x.id for x in op.procurement_draft_ids]
pro_ids = [x.id for x in procurement_draft_ids]
procure_datas = procurement_obj.read(
cr, uid, pro_ids, ['id', 'product_qty'], context=context)
to_generate = qty

View File

@ -172,9 +172,9 @@ class stock_location_route(osv.osv):
'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the route without removing it."),
'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'),
'product_selectable': fields.boolean('Selectable on Product'),
'product_categ_selectable': fields.boolean('Selectable on Product Category'),
'warehouse_selectable': fields.boolean('Selectable on Warehouse'),
'product_selectable': fields.boolean('Applicable on Product'),
'product_categ_selectable': fields.boolean('Applicable on Product Category'),
'warehouse_selectable': fields.boolean('Applicable on Warehouse'),
'supplied_wh_id': fields.many2one('stock.warehouse', 'Supplied Warehouse'),
'supplier_wh_id': fields.many2one('stock.warehouse', 'Supplier Warehouse'),
}
@ -239,6 +239,25 @@ class stock_quant(osv.osv):
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.quant', context=c),
}
def action_view_quant_history(self, cr, uid, ids, context=None):
'''
This function returns an action that display the history of the quant, which
mean all the stock moves that lead to this quant creation with this quant quantity.
'''
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
result = mod_obj.get_object_reference(cr, uid, 'stock', 'action_move_form2')
id = result and result[1] or False
result = act_obj.read(cr, uid, [id], context={})[0]
move_ids = []
for quant in self.browse(cr, uid, ids, context=context):
move_ids += [move.id for move in quant.history_ids]
result['domain'] = "[('id','in',[" + ','.join(map(str, move_ids)) + "])]"
return result
def quants_reserve(self, cr, uid, quants, move, context=None):
toreserve = []
for quant,qty in quants:
@ -1937,7 +1956,7 @@ class stock_move(osv.osv):
if move.move_dest_id and move.propagate:
new_move_prop = self.split(cr, uid, move.move_dest_id, qty, context=context)
self.write(cr, uid, [new_move], {'move_dest_id': new_move_prop}, context=context)
self.action_confirm(cr, uid, [new_move], context=context)
return new_move
@ -1953,6 +1972,31 @@ class stock_inventory(osv.osv):
res[inv.id] = True
return res
def _get_available_filters(self, cr, uid, context=None):
"""
This function will return the list of filter allowed according to the options checked
in 'Settings\Warehouse'.
:rtype: list of tuple
"""
#default available choices
res_filter = [('none', ' All products of a whole location'), ('product', 'One product only')]
settings_obj = self.pool.get('stock.config.settings')
config_ids = settings_obj.search(cr, uid, [], limit=1, order='id DESC', context=context)
#If we don't have updated config until now, all fields are by default false and so should be not dipslayed
if not config_ids:
return res_filter
stock_settings = settings_obj.browse(cr, uid, config_ids[0], context=context)
if stock_settings.group_stock_tracking_owner:
res_filter.append(('owner', 'One owner only'))
res_filter.append(('product_owner', 'One product for a specific owner'))
if stock_settings.group_stock_production_lot:
res_filter.append(('lot', 'One Lot/Serial Number'))
if stock_settings.group_stock_tracking_lot:
res_filter.append(('pack', 'A Pack'))
return res_filter
_columns = {
'name': fields.char('Inventory Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Name."),
'date': fields.datetime('Inventory Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Create Date."),
@ -1967,12 +2011,12 @@ class stock_inventory(osv.osv):
'partner_id': fields.many2one('res.partner', 'Owner', readonly=True, states={'draft': [('readonly', False)]}, help="Specify Owner to focus your inventory on a particular Owner."),
'lot_id': fields.many2one('stock.production.lot', 'Lot/Serial Number', readonly=True, states={'draft': [('readonly', False)]}, help="Specify Lot/Serial Number to focus your inventory on a particular Lot/Serial Number."),
'move_ids_exist': fields.function(_get_move_ids_exist, type='boolean', string=' Stock Move Exists?', help='technical field for attrs in view'),
'filter': fields.selection([('product', 'Product'), ('owner', 'Owner'), ('product_owner','Product & Owner'), ('lot','Lot/Serial Number'), ('pack','Pack'), ('none', 'None')], 'Selection Filter'),
'filter': fields.selection(_get_available_filters, 'Selection Filter'),
}
def _default_stock_location(self, cr, uid, context=None):
try:
warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0')
warehouse = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'warehouse0')
return warehouse.lot_stock_id.id
except:
return False
@ -2129,7 +2173,8 @@ class stock_inventory(osv.osv):
product_line['inventory_id'] = inventory.id
product_line['th_qty'] = product_line['product_qty']
if product_line['product_id']:
product_line['product_uom_id'] = product_obj.browse(cr, uid, product_line['product_id'], context=context).uom_id.id
product = product_obj.browse(cr, uid, product_line['product_id'], context=context)
product_line['product_uom_id'] = product.uom_id.id
vals.append(product_line)
return vals
@ -2578,8 +2623,9 @@ class stock_warehouse(osv.osv):
}, context=context)
vals['view_location_id'] = wh_loc_id
#create all location
reception_steps = vals.get('reception_steps', False)
delivery_steps = vals.get('delivery_steps', False)
def_values = self.default_get(cr, uid, {'reception_steps', 'delivery_steps'})
reception_steps = vals.get('reception_steps', def_values['reception_steps'])
delivery_steps = vals.get('delivery_steps', def_values['delivery_steps'])
context_with_inactive = context.copy()
context_with_inactive['active_test'] = False
sub_locations = [
@ -2627,8 +2673,10 @@ class stock_warehouse(osv.osv):
#choose the next available color for the picking types of this warehouse
all_used_colors = self.pool.get('stock.picking.type').search_read(cr, uid, [('warehouse_id', '!=', False), ('color', '!=', False)], ['color'], order='color')
not_used_colors = list(set(range(1, 10)) - set([x['color'] for x in all_used_colors]))
color = not_used_colors and not_used_colors[0] or 1
not_used_colors = list(set(range(0, 9)) - set([x['color'] for x in all_used_colors]))
color = 0
if not_used_colors:
color = not_used_colors[0]
in_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Receptions'),
@ -3178,15 +3226,16 @@ class stock_warehouse_orderpoint(osv.osv):
_name = "stock.warehouse.orderpoint"
_description = "Minimum Inventory Rule"
def _get_draft_procurements(self, cr, uid, ids, field_name, arg, context=None):
def get_draft_procurements(self, cr, uid, ids, context=None):
if context is None:
context = {}
result = {}
if not isinstance(ids, list):
ids = [ids]
procurement_obj = self.pool.get('procurement.order')
for orderpoint in self.browse(cr, uid, ids, context=context):
procurement_ids = procurement_obj.search(cr, uid, [('state', '=', 'draft'), ('product_id', '=', orderpoint.product_id.id), ('location_id', '=', orderpoint.location_id.id)])
result[orderpoint.id] = procurement_ids
return result
procurement_ids = procurement_obj.search(cr, uid, [('state', 'not in', ('cancel', 'done')), ('product_id', '=', orderpoint.product_id.id), ('location_id', '=', orderpoint.location_id.id)], context=context)
return list(set(procurement_ids))
def _check_product_uom(self, cr, uid, ids, context=None):
'''
@ -3201,6 +3250,18 @@ class stock_warehouse_orderpoint(osv.osv):
return True
def action_view_proc_to_process(self, cr, uid, ids, context=None):
act_obj = self.pool.get('ir.actions.act_window')
mod_obj = self.pool.get('ir.model.data')
draft_ids = self.get_draft_procurements(cr, uid, ids, context=context)
result = mod_obj.get_object_reference(cr, uid, 'procurement', 'do_view_procurements')
if not result:
return False
result = act_obj.read(cr, uid, [result[1]], context=context)[0]
result['domain'] = "[('id', 'in', [" + ','.join(map(str, draft_ids)) + "])]"
return result
_columns = {
'name': fields.char('Name', size=32, required=True),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the orderpoint without removing it."),
@ -3218,9 +3279,7 @@ class stock_warehouse_orderpoint(osv.osv):
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will be rounded up to this multiple."),
'procurement_id': fields.many2one('procurement.order', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'procurement_draft_ids': fields.function(_get_draft_procurements, type='many2many', relation="procurement.order", \
string="Related Procurement Orders", help="Draft procurement of the product and location of that orderpoint"),
'company_id': fields.many2one('res.company', 'Company', required=True)
}
_defaults = {
'active': lambda *a: 1,
@ -3424,11 +3483,11 @@ class stock_picking_type(osv.osv):
return res and res[0] or False
_columns = {
'name': fields.char('name', translate=True, required=True),
'name': fields.char('Name', translate=True, required=True),
'complete_name': fields.function(_get_name, type='char', string='Name'),
'pack': fields.boolean('Prefill Pack Operations', help='This picking type needs packing interface'),
'auto_force_assign': fields.boolean('Automatic Availability', help='This picking type does\'t need to check for the availability in source location.'),
'color': fields.integer('Color Index'),
'color': fields.integer('Color'),
'delivery': fields.boolean('Print delivery'),
'sequence_id': fields.many2one('ir.sequence', 'Reference Sequence', required=True),
'default_location_src_id': fields.many2one('stock.location', 'Default Source Location'),
@ -3436,7 +3495,7 @@ class stock_picking_type(osv.osv):
#TODO: change field name to "code" as it's not a many2one anymore
'code_id': fields.selection([('incoming', 'Suppliers'), ('outgoing', 'Customers'), ('internal', 'Internal')], 'Picking type code', required=True),
'return_picking_type_id': fields.many2one('stock.picking.type', 'Picking Type for Returns'),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', ondelete='cascade'),
'active': fields.boolean('Active'),
# Statistics for the kanban view

View File

@ -11,7 +11,7 @@
<menuitem id="menu_stock_warehouse_mgmt" name="Operations" parent="menu_stock_root" sequence="1"/>
<menuitem id="menu_stock_product" name="Products" parent="menu_stock_root" sequence="6"/>
<menuitem name="Products by Category" id="menu_product_by_category_stock_form" action="product.product_category_action"
parent="stock.menu_stock_product" sequence="0"/>
parent="stock.menu_stock_product" sequence="0" groups="base.group_no_one"/>
<menuitem action="product.product_normal_action" id="menu_stock_products_menu" parent="menu_stock_product" sequence="1"/>
<menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15" groups="group_stock_manager"/>
<menuitem id="menu_warehouse_config" name="Warehouse Management" parent="menu_stock_configuration" sequence="40" groups="base.group_no_one"/>
@ -47,24 +47,6 @@
</tree>
</field>
</record>
<record id="view_inventory_line_form" model="ir.ui.view">
<field name="name">stock.inventory.line.form</field>
<field name="model">stock.inventory.line</field>
<field name="arch" type="xml">
<form string="Stock Inventory Lines" version="7.0">
<group col="4">
<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','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom_id" groups="product.group_uom"/>
<field domain="[('usage','=','internal')]" name="location_id"/>
<field name="th_qty" readonly="1"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split Inventory Line"
type="action" icon="gtk-justify-fill"/>
</group>
</form>
</field>
</record>
<record id="view_inventory_filter" model="ir.ui.view">
<field name="name">stock.inventory.filter</field>
@ -120,11 +102,11 @@
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<separator string="Inventory"/>
<div class="oe_grey" colspan="4">Specify filters to focus your inventory a on particular product, lot, pack and product's owner.</div>
<group>
<label for="filter"/>
<div colspan="4">
<field name="filter" widget='radio'/>
<field name="filter" widget='radio' attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</div>
</group>
<group>
@ -136,7 +118,7 @@
</group>
<notebook attrs="{'invisible':[('state','=','draft')]}">
<page string="Inventory Details" >
<button name="set_checked_qty" states="confirm" string="⇒ Set Checked Quantity to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
<button name="set_checked_qty" states="confirm" string="⇒ Set quantities to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
<field name="line_ids" string="Inventory Details" context="{'default_location_id': location_id, 'default_product_id': product_id, 'default_prod_lot_id': lot_id, 'default_package_id': package_id, 'default_partner_id': partner_id}">
<tree string="Inventory Details" editable="bottom" colors="blue: product_qty != th_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,partner_id,prod_lot_id,package_id)" domain="[('type','=','product')]"/>
@ -146,7 +128,7 @@
<field name="package_id" on_change="on_change_product_id(location_id,product_id,product_uom_id,partner_id,prod_lot_id,package_id)" groups="stock.group_tracking_lot"/>
<field name="partner_id" on_change="on_change_product_id(location_id,product_id,product_uom_id,partner_id,prod_lot_id,package_id)" groups="stock.group_tracking_owner"/>
<field name="th_qty" readonly="1"/>
<field name="product_qty" string="Checked Quantity"/>
<field name="product_qty" string="Real Quantity"/>
<field name="state" invisible="True"/>
</tree>
</field>
@ -167,8 +149,8 @@
states="draft,waiting,confirmed,assigned"
groups="base.group_user"/>
<field name="scrapped" invisible="1"/>
<field name="location_id" groups="stock.group_locations"/>
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="state"/>
</tree>
</field>
@ -772,7 +754,7 @@
<button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action" groups="base.group_user"/>
<button name="action_cancel" states="assigned,confirmed,draft" string="Cancel Transfer" groups="base.group_user" type="object"/>
<button name="do_unreserve" string="Unreserve" groups="base.group_user" type="object" attrs="{'invisible': ['|',('quant_reserved_exist', '=', False), ('state','!=','assigned')]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
</header>
<sheet>
<h1>
@ -780,8 +762,7 @@
</h1>
<group>
<group>
<field name="partner_id"/>
<field name="group_id"/>
<field name="partner_id"/>
<field name="backorder_id" readonly="1" attrs="{'invisible': [('backorder_id','=',False)]}"/>
</group>
<group>
@ -799,11 +780,17 @@
<notebook>
<page string="Products">
<separator string="Expected Quantities" attrs="{'invisible': [('pack_operation_exist', '=', False)]}"/>
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'default_picking_type_id': picking_type_id}"/>
<separator string="In Process Quantities" attrs="{'invisible': [('pack_operation_exist', '=', False)]}"/>
<field name="pack_operation_exist" invisible="1"/>
<button name="action_pack" string="Create Package" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state', 'not in', ('draft','assigned','confirmed'))]}"/>
<button name="do_split" string="Create Draft Backorder" groups="base.group_no_one" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state','!=','assigned')]}"/>
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'default_picking_type_id': picking_type_id,'default_picking_id': active_id}"/>
<group>
<group col="3">
<separator string="Quantities Done" attrs="{'invisible': [('pack_operation_exist', '=', False)]}"/>
</group>
<group col="1">
<field name="pack_operation_exist" invisible="1"/>
<button name="action_pack" string="Create Package" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state', 'not in', ('draft','assigned','confirmed'))]}" class="oe_link oe_right oe_inline"/>
<button name="do_split" string="Create Draft Backorder" groups="base.group_no_one" type="object" attrs="{'invisible': ['|',('pack_operation_exist', '=', False),('state','!=','assigned')]}" class="oe_link oe_right oe_inline"/>
</group>
</group>
<field name="pack_operation_ids" attrs="{'invisible': [('pack_operation_exist', '=', False)]}" context="{'default_owner_id': owner_id}">
<tree editable="top">
<field name="product_id"/>
@ -828,6 +815,7 @@
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date_done" groups="base.group_no_one"/>
<field name="group_id"/>
</group>
</group>
</page>
@ -1071,7 +1059,7 @@
</header>
<sheet>
<group>
<group name="main_grp" string="Details" colspan="4">
<group name="main_grp" colspan="4">
<group name="main_grp_col1">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<label for="product_uom_qty"/>
@ -1094,10 +1082,12 @@
<field name="product_uos" class="oe_inline"/>
</div>
</group>
<group name="main_grp_col1">
<group name="main_grp_col2">
<field name="picking_type_id"/>
<field name="picking_priority"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
<field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
</group>
</group>
<group name="origin_grp" string="Origin">
@ -1108,12 +1098,9 @@
<field name="procure_method" attrs="{'readonly': [('state', '!=', 'draft')]}" groups="base.group_no_one"/>
<field name="group_id"/>
</group>
<group name="destination_grp" string="Destination">
<field name="location_dest_id" groups="stock.group_locations"/>
<field name="partner_id" context="{'contact_display':'partner'}"
groups="stock.group_locations"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/>
<field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
<group name="destination_grp" string="Destination" groups="stock.group_locations">
<field name="location_dest_id" />
<field name="partner_id" context="{'contact_display':'partner'}" />
</group>
<group name="quants_grp" string="Reserved Quants" colspan="4" groups="base.group_no_one">
<field name="reserved_quant_ids"/>
@ -1127,9 +1114,9 @@
<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 eval="20" name="priority"/>
<field name="arch" type="xml">
<form string="Stock Moves" version="7.0">
<form string="Stock Moves" version="7.0">
<header>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_user"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" groups="base.group_user"/>
@ -1138,9 +1125,7 @@
</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="picking_type_id" invisible="1"/>
<field name="procure_method"/>
<label for="product_uom_qty"/>
<div>
@ -1152,27 +1137,23 @@
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_uom_qty, product_uom, product_uos)" class="oe_inline"/>
</div>
<field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]"/>
<field name="partner_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>
<field name="reserved_quant_ids"/>
<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_uom_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>
</form>
</field>
</record>
@ -1383,7 +1364,7 @@
<field name="model">stock.picking.type</field>
<field name="arch" type="xml">
<search string="Picking Type">
<field name="name" string="Picking Type"/>
<field name="name"/>
<field name="sequence_id"/>
<field name="warehouse_id"/>
</search>
@ -1394,9 +1375,9 @@
<field name="model">stock.picking.type</field>
<field name="arch" type="xml">
<tree string="Picking Types">
<field name="complete_name"/>
<field name="name"/>
<field name="warehouse_id"/>
<field name="sequence_id"/>
<field name="pack"/>
</tree>
</field>
</record>
@ -1601,6 +1582,9 @@
<field name="arch" type="xml">
<form string="Reordering Rules" version="7.0">
<sheet>
<div class="oe_right oe_button_box">
<button name="action_view_proc_to_process" type="object" string="Procurement Orders to Process"/>
</div>
<group>
<group>
<field name="name" />
@ -1623,10 +1607,7 @@
<field name="procurement_id" readonly="1"/>
<field name="active" />
</group>
</group>
<group string="Procurement Orders to Process">
<field name="procurement_draft_ids" nolabel="1"/>
</group>
</group>
</sheet>
</form>
</field>
@ -1777,7 +1758,10 @@
<field name="model">stock.quant</field>
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<form string="Quants">
<form string="Quants" version="7.0">
<div class="oe_right oe_button_box">
<button name="action_view_quant_history" type="object" string="Quant History"/>
</div>
<field name="product_id"/>
<field name="qty"/>
<field name="lot_id" groups="stock.group_production_lot"/>
@ -1786,7 +1770,6 @@
<field name="in_date"/>
<field name="reservation_id"/>
<field name="propagated_from_id"/>
<field name="history_ids"/>
<field name="owner_id" groups="stock.group_tracking_owner"/>
</form>
</field>
@ -1799,7 +1782,7 @@
<field eval="10" name="priority"/>
<field name="arch" type="xml">
<tree string="Quants" create="0">
<field name="product_id"/>
<field name="product_id" invisible="1"/>
<field name="qty"/>
<field name="location_id"/>
<field name="owner_id" groups="stock.group_tracking_owner"/>
@ -2053,13 +2036,15 @@
<field name="arch" type="xml">
<form string="Route" version="7.0">
<sheet>
<group string="Route">
<group>
<field name="name" class="oe_inline"/>
</group>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
<group>
<group>
<field name="sequence" string="Sequence" groups="base.group_no_one"/>
</group>
<group>
<field name="active" groups="stock.group_adv_location" />
</group>
</group>
@ -2112,7 +2097,7 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button name="action_view_routes" string="View Logistic Flows" type="object" />
<button name="action_view_routes" string="Routes" type="object" />
</xpath>
</field>
</record>

View File

@ -22,6 +22,7 @@
-
!record {model: stock.inventory.line, id: inventory_testline0}:
inventory_id: stock.inventory_test0
product_uom_id: product.product_uom_unit
product_id: inventory_product
product_qty: 10
location_id: stock.stock_location_14

View File

@ -141,7 +141,15 @@ class stock_return_picking(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
new_picking_id, pick_type_id = self._create_returns(cr, uid, ids, context=context)
ctx = {'default_picking_type_id': pick_type_id}
ctx = {
'default_picking_type_id': pick_type_id,
# Probably a more beautiful way to do that ??? QDP ? (feedback please)
'search_default_draft': 0,
'search_default_assigned': 0,
'search_default_confirmed': 0,
'search_default_ready': 0,
'search_default_late': 0,
}
return {
'domain': "[('id', 'in', [" + str(new_picking_id) + "])]",
'name': _('Returned Picking'),