[IMP] Improve and fix according to review FP

bzr revid: jke@openerp.com-20131105161517-zm1ks2m8fkcf7v7i
This commit is contained in:
jke-openerp 2013-11-05 17:15:17 +01:00
parent 473d530b3e
commit 5308a926d2
10 changed files with 196 additions and 134 deletions

View File

@ -127,7 +127,8 @@ 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'),
# TODO REMOVE IF NO IMPACT
#'message': fields.text('Latest error', help="Exception occurred while computing procurement orders.", track_visibility='onchange'),
}
_defaults = {

View File

@ -51,13 +51,11 @@
</group>
<newline/>
<group>
<field name="rule_id"/>
<field name="date_planned"/>
<field name="priority"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group>
<field name="group_id"/>
<group>
<field name="origin" class="oe_inline" placeholder="e.g. SO005"/>
</group>
</group>
@ -65,8 +63,12 @@
<page string="Extra Information">
<label for="name" class="oe_edit_only"/>
<field name="name" placeholder="External note..."/>
<label for="message" class="oe_edit_only"/>
<field name="message"/>
<!--<label for="message" class="oe_edit_only"/>
<field name="message"/> -->
</page>
<page string="Advanced Information" name="adv_info">
<field name="group_id"/>
<field name="rule_id"/>
</page>
</notebook>
</sheet>
@ -136,18 +138,20 @@
<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.
</p>
</field>
</field>
</record>
<record id="procurement_exceptions" model="ir.actions.act_window">
@ -159,9 +163,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

@ -12,7 +12,7 @@
<filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
<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)]"/>
<filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
<field name="categ_id"/>
<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! -->
@ -384,11 +384,20 @@
<field name="view_mode">tree,form,kanban</field>
<field name="context">{'categ_id':active_id, 'search_default_categ_id':active_id}</field>
</record>
<record id="product_category_action_tree" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban</field>
<field name="context">{'categ_id':active_id, 'search_default_categ_id':active_id}</field>
</record>
<record id="ir_product_category_open" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>
<field eval="'product.category'" name="model"/>
<field name="name">Products by Categories</field>
<field eval="'ir.actions.act_window,%d'%product_normal_action_tree" name="value"/>
<field eval="'ir.actions.act_window,%d'%product_category_action_tree" name="value"/>
</record>

View File

@ -443,5 +443,5 @@ class stock_move(osv.osv):
class stock_location_route(osv.osv):
_inherit = "stock.location.route"
_columns = {
'sale_selectable':fields.boolean("Selectable on Sales Order Line")
'sale_selectable':fields.boolean("Applicable on Sales Order Line")
}

View File

@ -378,9 +378,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'),
}
@ -1946,6 +1946,44 @@ class stock_inventory(osv.osv):
if inv.move_ids:
res[inv.id] = True
return res
def _getFilter(self,cr,uid,context=None):
"""
This function will return the list of filter allowed according to
the option checked in Configuration -> Warehouse
It replace the older selection field 'filter' :
'filter': fields.selection(
[('product', 'Product'), ('owner', 'Owner'),
('product_owner','Product & Owner'),
('lot','Lot/Serial Number'), ('pack','Pack'), ('none', 'None')]
, 'Selection Filter'),
@return: List of tuple for a field of type selecttion
"""
res_filter = [
('none', ' All products of a whole location'),
('product', 'One product only'),
]
obj_set = self.pool.get('stock.config.settings')
config_browse = obj_set.search(cr,uid,[],limit=1, order='id DESC',context=context);
#If we don't have updated config until now, all fields are by defaut false and so should be not dipslay
if not config_browse:
return res_filter
group_rights = obj_set.browse(cr,uid,config_browse[0],context=context);
if group_rights.group_stock_tracking_owner:
res_filter.append(('owner', 'One owner only'))
res_filter.append(('product_owner','One product for a specific owner'))
if group_rights.group_stock_production_lot:
res_filter.append(('lot','One Lot/Serial Number'))
if group_rights.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."),
@ -1961,7 +1999,7 @@ 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(_getFilter, 'Selection Filter'),
}
def _default_stock_location(self, cr, uid, context=None):
@ -2238,6 +2276,11 @@ class stock_warehouse(osv.osv):
'resupply_wh_ids': fields.many2many('stock.warehouse', 'stock_wh_resupply_table', 'supplied_wh_id', 'supplier_wh_id', 'Resupply Warehouses'),
'resupply_route_ids': fields.one2many('stock.location.route', 'supplied_wh_id', 'Resupply Routes'),
'default_resupply_wh_id': fields.many2one('stock.warehouse', 'Default Resupply Warehouse'),
'color': fields.selection([
(0,'White'),(1,'Gray'),(2,'Red'),
(3,'Yellow'), (4,'Spring green'), (5,'Green'),
(6,'Aqua'), (7,'Blue'), (8,'Violet'), (9,'Pink'),
]),
}
def onchange_filter_default_resupply_wh_id(self, cr, uid, ids, default_resupply_wh_id, resupply_wh_ids, context=None):
@ -2304,12 +2347,22 @@ class stock_warehouse(osv.osv):
return warehouse.lot_stock_id.id
except:
return False
def _default_color(self,cr,uid,context=None):
all_used_colors = self.search_read(cr, uid, [('color','!=',False)], ['color'], order='color')
if not len(all_used_colors):
return 0
not_used_colors = list(set(range(1, 10)) - set([x['color'] for x in all_used_colors]))
#Rem : if not_used_colors[0] == 0 ==> return XXX from "or XXX"
color = not_used_colors and not_used_colors[0] or 1
return color
_defaults = {
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
'lot_stock_id': _default_stock_id,
'reception_steps': 'one_step',
'delivery_steps': 'ship_only',
'color': _default_color,
}
_sql_constraints = [
('warehouse_name_uniq', 'unique(name, company_id)', 'The name of the warehouse must be unique per company!'),
@ -2396,7 +2449,7 @@ class stock_warehouse(osv.osv):
try:
mto_route_id = data_obj.get_object_reference(cr, uid, 'stock', 'route_warehouse0_mto')[1]
except:
mto_route_id = route_obj.search(cr, uid, [('name', 'like', _('MTO'))], context=context)
mto_route_id = route_obj.search(cr, uid, ['|',('name', 'like', _('MTO')),('name', 'like', _('Buy/Product on Order'))], context=context)
mto_route_id = mto_route_id and mto_route_id[0] or False
if not mto_route_id:
raise osv.except_osv(_('Error!'), _('Can\'t find any generic MTO route.'))
@ -2549,8 +2602,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 = [
@ -2588,19 +2642,17 @@ class stock_warehouse(osv.osv):
#fetch customer and supplier locations, for references
customer_loc, supplier_loc = self._get_partner_locations(cr, uid, new_id, context=context)
#create in, out, internal picking types for warehouse
input_loc = wh_input_stock_loc
#create in, out, internal picking types for warehouse
if warehouse.reception_steps == 'one_step':
input_loc = wh_stock_loc
output_loc = wh_output_stock_loc
else:
input_loc = wh_input_stock_loc
if warehouse.delivery_steps == 'ship_only':
output_loc = wh_stock_loc
#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
else:
output_loc = wh_output_stock_loc
in_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Receptions'),
'warehouse_id': new_id,
@ -2609,7 +2661,7 @@ class stock_warehouse(osv.osv):
'sequence_id': in_seq_id,
'default_location_src_id': supplier_loc.id,
'default_location_dest_id': input_loc.id,
'color': color}, context=context)
}, context=context)
out_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Delivery Orders'),
'warehouse_id': new_id,
@ -2618,7 +2670,7 @@ class stock_warehouse(osv.osv):
'delivery': True,
'default_location_src_id': output_loc.id,
'default_location_dest_id': customer_loc.id,
'color': color}, context=context)
}, context=context)
int_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Internal Transfers'),
'warehouse_id': new_id,
@ -2628,7 +2680,7 @@ class stock_warehouse(osv.osv):
'default_location_dest_id': wh_stock_loc.id,
'active': reception_steps != 'one_step',
'pack': False,
'color': color}, context=context)
}, context=context)
pack_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Pack'),
'warehouse_id': new_id,
@ -2638,7 +2690,7 @@ class stock_warehouse(osv.osv):
'default_location_dest_id': output_loc.id,
'active': delivery_steps == 'pick_pack_ship',
'pack': True,
'color': color}, context=context)
}, context=context)
pick_type_id = picking_type_obj.create(cr, uid, vals={
'name': _('Pick'),
'warehouse_id': new_id,
@ -2648,7 +2700,7 @@ class stock_warehouse(osv.osv):
'default_location_dest_id': wh_pack_stock_loc.id,
'active': delivery_steps != 'ship_only',
'pack': False,
'color': color}, context=context)
}, context=context)
#write picking types on WH
vals = {
@ -3034,6 +3086,8 @@ class stock_package(osv.osv):
res['domain'] = [('id', 'in', quants_ids)]
return res
def _get_product_total_qty(self, cr, uid, package_record, product_id, context=None):
''' find the total of given product 'product_id' inside the given package 'package_id'''
quant_obj = self.pool.get('stock.quant')
@ -3147,16 +3201,15 @@ 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 = {}
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', '=', 'draft'), ('product_id', '=', orderpoint.product_id.id), ('location_id', '=', orderpoint.location_id.id)],context=context)
return procurement_ids
def _check_product_uom(self, cr, uid, ids, context=None):
'''
Check if the UoM has the same category as the product standard UoM
@ -3169,7 +3222,18 @@ class stock_warehouse_orderpoint(osv.osv):
return False
return True
def action_view_po_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 = set([r for r in self.get_draft_procurements(cr, uid, ids, context=context)])
result = mod_obj.get_object_reference(cr, uid, 'procurement', 'do_view_procurements')
id = result and result[1] or False
result = act_obj.read(cr, uid, [id], 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."),
@ -3187,9 +3251,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,
@ -3397,7 +3459,8 @@ class stock_picking_type(osv.osv):
'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.related('warehouse_id', 'color', type='integer', string='Color Index'),
'delivery': fields.boolean('Print delivery'),
'sequence_id': fields.many2one('ir.sequence', 'Sequence', required=True),
'default_location_src_id': fields.many2one('stock.location', 'Default Source Location'),
@ -3405,7 +3468,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

@ -96,7 +96,7 @@ watch your stock valuation, and track production lots upstream and downstream (b
-->
<record id="route_warehouse0_mto" model='stock.location.route'>
<field name="name">MTO</field>
<field name="name">Buy/Product on Order</field>
<field name="sequence">10</field>
</record>
@ -139,10 +139,8 @@ watch your stock valuation, and track production lots upstream and downstream (b
Resource: stock.warehouse
-->
<record id="warehouse0" model="stock.warehouse">
<field model="res.company" name="name" search="[]" use="name"/>
<field model="res.company" name="name" search="[]" use="name"/>
<field name="code">WH</field>
</record>

View File

@ -257,14 +257,14 @@
<field name="name">Chicago Warehouse</field>
<field name="lot_stock_id" ref="stock_location_shop0"/>
<field name="partner_id" ref="res_partner_address_41"/>
<field name="company_id" ref="res_company_1"/>
<field name="company_id" ref="res_company_1"/>
<field name="code">Chic</field>
</record>
<record id="stock_warehouse_shop1" model="stock.warehouse">
<field name="name">Birmingham Warehouse</field>
<field name="lot_stock_id" ref="stock_location_shop1"/>
<field name="partner_id" ref="res_partner_address_40"/>
<field name="company_id" ref="res_company_1"/>
<field name="company_id" ref="res_company_1"/>
<field name="code">Birm</field>
</record>

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"/>
@ -122,7 +122,6 @@
</group>
<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'/>
</div>
@ -136,7 +135,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 +145,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>
@ -661,6 +660,7 @@
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="partner_id"/>
<field name="color" string="Color in Kanban view" class="oe_edit_only"/>
</group>
<notebook colspan="4" groups="stock.group_adv_location">
<page string="Warehouse Configuration" colspan="4">
@ -687,7 +687,7 @@
<field name="out_type_id" readonly="1"/>
</group>
</group>
</page>
</page>
</notebook>
</group>
</sheet>
@ -771,7 +771,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>
@ -779,8 +779,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>
@ -798,11 +797,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"/>
@ -827,6 +832,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>
@ -1070,7 +1076,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"/>
@ -1093,10 +1099,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">
@ -1107,12 +1115,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"/>
@ -1126,53 +1131,16 @@
<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="inherit_id" ref="view_move_form" />
<field eval="20" name="priority"/>
<field name="arch" type="xml">
<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"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" groups="base.group_user"/>
<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="picking_type_id" invisible="1"/>
<field name="procure_method"/>
<label for="product_uom_qty"/>
<div>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_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="terp-gtk-jump-to-ltr" 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_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"/>
</group>
</form>
<field name="picking_id" position="replace">
<field name="picking_id" invisible="1"/>
</field>
<!-- domain on picking_id has been removed -->
<field name="picking_type_id" position="replace" />
<field name="picking_priority" position="replace"/>
<field name="group_id" position="replace"/>
</field>
</record>
@ -1600,8 +1568,11 @@
<field name="arch" type="xml">
<form string="Reordering Rules" version="7.0">
<sheet>
<div class="oe_right oe_button_box">
<button name="action_view_po_to_process" type="object" string="Procurement Orders to Process" icon="gtk-execute" />
</div>
<group>
<group>
<group>
<field name="name" />
<field name="product_id" on_change="onchange_product_id(product_id)"/>
</group>
@ -1622,10 +1593,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>
@ -2130,7 +2098,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

@ -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'),