[IMP] stock: split incomming shipments/delivery orders with new classes

bzr revid: qdp-launchpad@openerp.com-20120504153613-a92kqasbclihuinp
This commit is contained in:
Quentin (OpenERP) 2012-05-04 17:36:13 +02:00
parent 2de6d6bbf5
commit b08c501123
7 changed files with 212 additions and 433 deletions

View File

@ -535,14 +535,6 @@ stock_tracking()
#----------------------------------------------------------
# Stock Picking
#----------------------------------------------------------
PICK_STATE = [
('draft', 'Draft'),
('auto', 'Waiting Another Operation'),
('confirmed', 'Waiting Availability'),
('assigned', 'Ready to Process'),
('done', 'Done'),
('cancel', 'Cancelled'),
]
class stock_picking(osv.osv):
_name = "stock.picking"
_inherit = ['mail.thread']
@ -615,19 +607,6 @@ class stock_picking(osv.osv):
res[pick]['max_date'] = dt2
return res
def _tooltip_picking_state(self, state=None):
# Update the tooltip of state field based on shipment type e.g: Delivery, Reception and Internal Transfer
if state is None:
state = PICK_STATE
_tooltip_state_assigned = state.get('assigned', False)
_tooltip_state_done = state.get('done', False)
return _("* Draft: not confirmed yet and will not be scheduled until confirmed\n"\
"* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n"\
"* Waiting Availability: still waiting for the availability of products\n"\
"* %s: products reserved, simply waiting for confirmation.\n"\
"* %s: has been processed, can't be modified or cancelled anymore\n"\
"* Cancelled: has been cancelled, can't be confirmed anymore") % (_tooltip_state_assigned, _tooltip_state_done)
def create(self, cr, user, vals, context=None):
if ('name' not in vals) or (vals.get('name')=='/'):
seq_obj_name = 'stock.picking.' + vals['type']
@ -649,7 +628,20 @@ class stock_picking(osv.osv):
"if you subcontract the manufacturing operations.", select=True),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Location where the system will stock the finished products.", select=True),
'move_type': fields.selection([('direct', 'Partial'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="It specifies goods to be deliver partially or all at once"),
'state': fields.selection(PICK_STATE, 'State', readonly=True, select=True),
'state': fields.selection([
('draft', 'Draft'),
('auto', 'Waiting Another Operation'),
('confirmed', 'Waiting Availability'),
('assigned', 'Ready to Transfer'),
('done', 'Transferred'),
('cancel', 'Cancelled'),], 'State', readonly=True, select=True, help="""
* Draft: not confirmed yet and will not be scheduled until confirmed\n
* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n
* Waiting Availability: still waiting for the availability of products\n
* Ready to Transfer: products reserved, simply waiting for confirmation.\n
* Transferred: has been processed, can't be modified or cancelled anymore\n
* Cancelled: has been cancelled, can't be confirmed anymore"""
),
'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
store=True, type='datetime', string='Scheduled Date', select=1, help="Scheduled date for the shipment to be processed"),
'date': fields.datetime('Order Date', help="Date of order", select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
@ -678,72 +670,11 @@ class stock_picking(osv.osv):
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Reference must be unique per Company!'),
]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:
context = {}
mod_obj = self.pool.get('ir.model.data')
# To get the right view of shipment based on type from stock move and Back order.
if context.get('default_picking_id', False):
picking_type = self.browse(cr, uid, context['default_picking_id'], context=context).type
if picking_type == 'out':
context.update({'default_type':'out'})
view_id = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form')[1]
elif picking_type == 'in':
context.update({'default_type':'in'})
view_id = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_in_form')[1]
elif picking_type == 'internal':
context.update({'default_type':'internal'})
view_id = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_form')[1]
type = context.get('default_type', False)
res = super(stock_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
if type:
if res.get('toolbar', False):
# To update the report label according to shipping type
for report in res['toolbar']['print']:
if report['report_name'] != 'stock.picking.list':
continue
if type == 'in':
report['string'] = _('Receipt Slip')
elif type == 'internal':
report['string'] = _('Picking Slip')
elif type == 'out':
report['string'] = _('Delivery Slip')
report['name'] = report['string']
for field in res['fields']:
# To update the states label according to shipping type
if field == 'state':
_state = dict(PICK_STATE)
if type == 'in':
_state['assigned'] = _('Ready to Receive')
_state['done'] = _('Received')
elif type == 'internal':
_state['assigned'] = _('Ready to Transfer')
_state['done'] = _('Transferred')
elif type == 'out':
_state['assigned'] = _('Ready to Deliver')
_state['done'] = _('Delivered')
res['fields']['state']['selection'] = [(x[0], _state[x[0]]) for x in PICK_STATE]
res['fields']['state']['help'] = self._tooltip_picking_state(_state)
# To update the fields tooltips according to shipping type
if field == 'partner_id':
_tooltip = ''
if type == 'in':
_tooltip = _('supplier')
elif type == 'internal':
_tooltip = _('warehouse')
elif type == 'out':
_tooltip = _('customer')
res['fields']['partner_id']['help'] = _("Address of %s") %(_tooltip)
return res
def action_process(self, cr, uid, ids, context=None):
if context is None: context = {}
mod_obj = self.pool.get('ir.model.data')
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','stock_partial_picking_form')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
ctx = context.copy()
ctx.update({'active_model': 'stock.picking', 'active_ids': ids })
return {
'view_type': 'form',
'view_mode': 'form',
@ -752,7 +683,7 @@ class stock_picking(osv.osv):
'view_id': resource_id,
'type': 'ir.actions.act_window',
'target': 'new',
'context': ctx,
'context': context,
'nodestroy': True,
}
@ -2951,4 +2882,80 @@ class stock_warehouse(osv.osv):
stock_warehouse()
#----------------------------------------------------------
# "Empty" Classes that are used to vary from the original stock.picking (that are dedicated to the internal pickings)
# in order to offer a different usability with different views, labels, available reports/wizards...
#----------------------------------------------------------
class stock_picking_in(osv.osv):
_name = "stock.picking.in"
_inherit = "stock.picking"
_table = "stock_picking"
_description = "Incomming Shipments"
def check_access_rights(self, cr, uid, operation, raise_exception=True):
#override in order to redirect the check of acces rights on the stock.picking object
return self.pool.get('stock.picking').check_access_rights(cr, uid, operation, raise_exception=raise_exception)
def check_access_rule(self, cr, uid, ids, operation, context=None):
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
def _workflow_trigger(self, cr, uid, ids, trigger, context=None):
#override in order to trigger the workflow of stock.picking at the end of create, write and unlink operation
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_trigger(cr, uid, ids, trigger, context=context)
_columns = {
'state': fields.selection(
[('draft', 'Draft'),
('auto', 'Waiting Another Operation'),
('confirmed', 'Waiting Availability'),
('assigned', 'Ready to Receive'),
('done', 'Received'),
('cancel', 'Cancelled'),],
'State', readonly=True, select=True,
help="""* Draft: not confirmed yet and will not be scheduled until confirmed\n
* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n
* Waiting Availability: still waiting for the availability of products\n
* Ready to Receive: products reserved, simply waiting for confirmation.\n
* Received: has been processed, can't be modified or cancelled anymore\n
* Cancelled: has been cancelled, can't be confirmed anymore"""),
}
class stock_picking_out(osv.osv):
_name = "stock.picking.out"
_inherit = "stock.picking"
_table = "stock_picking"
_description = "Delivery Orders"
def check_access_rights(self, cr, uid, operation, raise_exception=True):
#override in order to redirect the check of acces rights on the stock.picking object
return self.pool.get('stock.picking').check_access_rights(cr, uid, operation, raise_exception=raise_exception)
def check_access_rule(self, cr, uid, ids, operation, context=None):
#override in order to redirect the check of acces rules on the stock.picking object
return self.pool.get('stock.picking').check_access_rule(cr, uid, ids, operation, context=context)
def _workflow_trigger(self, cr, uid, ids, trigger, context=None):
#override in order to trigger the workflow of stock.picking at the end of create, write and unlink operation
#instead of it's own workflow (which is not existing)
return self.pool.get('stock.picking')._workflow_trigger(cr, uid, ids, trigger, context=context)
_columns = {
'state': fields.selection(
[('draft', 'Draft'),
('auto', 'Waiting Another Operation'),
('confirmed', 'Waiting Availability'),
('assigned', 'Ready to Deliver'),
('done', 'Delivered'),
('cancel', 'Cancelled'),],
'State', readonly=True, select=True,
help="""* Draft: not confirmed yet and will not be scheduled until confirmed\n
* Waiting Another Operation: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n
* Waiting Availability: still waiting for the availability of products\n
* Ready to Deliver: products reserved, simply waiting for confirmation.\n
* Delivered: has been processed, can't be modified or cancelled anymore\n
* Cancelled: has been cancelled, can't be confirmed anymore"""),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,7 +2,9 @@
<openerp>
<data>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Stock Level Forecast"/>
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Packing list" rml="stock/report/picking.rml"/>
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking Slip" rml="stock/report/picking.rml"/>
<report id="report_picking_list_in" model="stock.picking.in" name="stock.picking.list" string="Receipt Slip" rml="stock/report/picking.rml"/>
<report id="report_picking_list_out" model="stock.picking.out" name="stock.picking.list" string="Delivery Slip" rml="stock/report/picking.rml"/>
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
<report auto="False" id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Inventory Overview" rml="stock/report/lot_overview.rml"/>
<report id="report_location_overview_all" model="stock.location" name="lot.stock.overview_all" string="Location Content" rml="stock/report/lot_overview_all.rml"/>

View File

@ -654,6 +654,16 @@
<menuitem action="action_warehouse_form" id="menu_action_warehouse_form" groups="stock.group_locations"
parent="menu_stock_configuration" sequence="1"/>
<!--
STOCK PICKING
-->
<!--
#
# Defaults and Internal Pickings
#
-->
<record model="ir.ui.view" id="stock_picking_calendar">
<field name="name">stock.picking.calendar</field>
<field name="model">stock.picking</field>
@ -667,6 +677,7 @@
</calendar>
</field>
</record>
<record id="vpicktree" model="ir.ui.view">
<field name="name">stock.picking.tree</field>
<field name="model">stock.picking</field>
@ -685,6 +696,7 @@
</tree>
</field>
</record>
<record id="view_picking_form" model="ir.ui.view">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
@ -698,7 +710,7 @@
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" groups="stock.group_stock_user" type="object" icon="gtk-go-forward"/>
<button name="action_process" states="assigned" string="Transfer" groups="stock.group_stock_user" type="object" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl" />
<div class="oe_right">
<field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,progress,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
@ -825,38 +837,62 @@
</field>
</record>
<record id="view_stock_picking_filter" model="ir.ui.view">
<field name="name">stock.picking.list.select</field>
<record id="view_picking_internal_search" model="ir.ui.view">
<field name="name">stock.picking.internal.search</field>
<field name="model">stock.picking</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Stock Picking">
<search string="Internal Picking List">
<group>
<filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Available Pickings"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Pickings"/>
<filter icon="terp-check" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
<filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves" />
<filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
<separator orientation="vertical"/>
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
<separator orientation="vertical"/>
<filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Internal Pickings to invoice"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="partner_id"/>
<field name="origin"/>
<field name="stock_journal_id" widget="selection"/>
<field name="company_id" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
<separator orientation="vertical" />
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}" />
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_picking_tree6" model="ir.actions.act_window">
<field name="name">Internal Moves</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','internal')]</field>
<field name="context">{'contact_display': 'partner_address', 'search_default_available': 1}</field>
<field name="search_view_id" ref="view_picking_internal_search"/>
<field name="help">Internal Moves display all inventory operations you have to perform in your warehouse. All operations can be categorized into stock journals, so that each worker has his own list of operations to perform in his own journal. Most operations are prepared automatically by OpenERP according to your preconfigured logistics rules, but you can also record manual stock operations.</field>
</record>
<record model="ir.actions.act_window.view" id="action_picking_tree6_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="vpicktree"/>
<field name="act_window_id" ref="action_picking_tree6"/>
</record>
<record model="ir.actions.act_window.view" id="action_picking_tree6_form_view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_picking_form"/>
<field name="act_window_id" ref="action_picking_tree6"/>
</record>
<!--
#
# Sending Products
@ -882,143 +918,26 @@
</record>
<record id="view_picking_out_form" 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="view_picking_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl"/>
<div class="oe_right">
<data>
<xpath expr="/form/div[@class='oe_form_topbar']/button[@name='action_process']" position="replace">
<button name="action_process" states="assigned" string="Deliver" type="object" icon="gtk-go-forward"/>
</xpath>
<xpath expr="/form/div[@class='oe_form_topbar']/div[@class='oe_right']" position="replace">
<field name="state" nolabel="1" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
</div>
</div>
<sheet string="Delivery Orders" layout="auto">
<group col="6" colspan="4">
<group colspan="4" col="4">
<field name="name" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="invoice_state"/>
<field name="backorder_id" readonly="1"/>
</group>
<group colspan="2" col="2">
<field name="date"/>
<field name="min_date" readonly="1"/>
<field name="stock_journal_id" widget="selection"/>
</group>
</group>
<notebook colspan="4">
<page string="Products">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" context="{'address_out_id': partner_id, 'picking_type': type}" >
<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="UoM" 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" />
<field name="scrapped" invisible="1"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button name="%(track_line)d" string="Split in production lots" type="action"
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('prodlot_id','&lt;&gt;',False)]}"
states="draft,assigned,confirmed"
groups="stock.group_production_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
groups="stock.group_tracking_lot"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed"/>
<button name="%(split_into)d" string="Put in a new pack" type="action"
icon="terp-stock_effects-object-colorize"
groups="product.group_stock_packaging"
states="draft,assigned,confirmed"/>
<field name="location_id"/>
<field name="date"/>
<field name="state"/>
<button name="%(action_partial_move_server)d" string="Process" type="action" states="confirmed,assigned" icon="gtk-go-forward"/>
</tree>
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" invisible="1" colspan="4" />
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)" colspan="4" />
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="3" />
<button name="%(stock.move_scrap)d"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<field name="product_uom" string="Unit Of Measure" colspan="4" groups="product.group_uom"/>
<field name="product_uos_qty" groups="product.group_uos" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" colspan="4" />
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4" />
<field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]" colspan="4" />
</group>
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','=','internal')]" />
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4">
<separator string="Traceability" colspan="4" groups="stock.group_tracking_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot" colspan="3" />
<button name="%(split_into)d" string="New pack" type="action"
groups="stock.group_tracking_lot"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed" colspan="1"/>
<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)" colspan="3"/>
<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" colspan="1" />
</group>
<label string="" colspan="4"/>
<field name="state"/>
<group col="4" colspan="2">
<button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/>
</group>
</form>
</field>
</page>
<page string="Additional info">
<field name="auto_picking"/>
<field name="date_done"/>
<field name="move_type"/>
<field name="type"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</page>
<page string="Notes">
<field colspan="4" name="note" nolabel="1"/>
</page>
</notebook>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
</xpath>
<xpath expr="/form/sheet/group/group/field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4" string="Customer"/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</xpath>
</data>
</field>
</record>
@ -1058,12 +977,12 @@
<record id="action_picking_tree" model="ir.actions.act_window">
<field name="name">Delivery Orders</field>
<field name="res_model">stock.picking</field>
<field name="res_model">stock.picking.out</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','out')]</field>
<field name="context">{'default_type': 'out', 'contact_display': 'partner_address'}</field>
<field name="context">{'contact_display': 'partner_address'}</field>
<field name="search_view_id" ref="view_picking_out_search"/>
<field name="help">This is the list of all delivery orders that have to be prepared, according to your different sales orders and your logistics rules.</field>
</record>
@ -1086,9 +1005,14 @@
</record>
<menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_warehouse_mgmt" sequence="3"/>
<!--
#
# Incomming Shipments
#
-->
<record id="view_picking_in_tree" model="ir.ui.view">
<field name="name">stock.picking.in.tree</field>
<field name="model">stock.picking</field>
<field name="model">stock.picking.in</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state == 'draft';grey:state == 'done';red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list">
@ -1107,144 +1031,29 @@
</record>
<record id="view_picking_in_form" model="ir.ui.view">
<field name="name">stock.picking.in.form</field>
<field name="model">stock.picking</field>
<field name="model">stock.picking.in</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
<button name="%(act_stock_return_picking)d" string="Return Products" states="done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" attrs="{'invisible': ['|','|',('state','&lt;&gt;','done'),('invoice_state','=','invoiced'),('invoice_state','=','none')]}" type="action" icon="terp-gtk-go-back-rtl" />
<div class="oe_right">
<field name="state" nolabel="1" readonly="1" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
</div>
</div>
<sheet string="Input Picking List" layout="auto">
<group colspan="4" col="6">
<group colspan="4" col="4">
<field name="name" readonly="1"/>
<field name="origin"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4"/>
<field name="invoice_state" string="Invoice Control"/>
<field name="backorder_id" readonly="1"/>
</group>
<group colspan="2" col="2">
<field name="date"/>
<field name="min_date" readonly="1"/>
<field name="stock_journal_id" widget="selection"/>
</group>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" context="{'address_in_id': partner_id, 'picking_type': type}" >
<tree colors="grey:scrapped==True" string="Stock Moves">
<field name="product_id" />
<field name="product_qty" />
<field name="product_uom" string="UoM" groups="product.group_uom"/>
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned"/>
<field name="scrapped" invisible="1"/>
<field name="prodlot_id" groups="stock.group_production_lot"/>
<button
name="%(stock.track_line)d"
string="Split in production lots"
groups="stock.group_production_lot"
type="action" icon="terp-stock_effects-object-colorize"
states="draft,waiting,confirmed,assigned" />
<field name="tracking_id" groups="stock.group_tracking_lot"/>
<button name="setlast_tracking" string="Put in current pack" type="object"
groups="stock.group_tracking_lot"
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','&lt;&gt;',False)]}"
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"/>
<field name="state"/>
</tree>
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" invisible="1" colspan="4"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)" colspan="4"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="3"/>
<button name="%(stock.move_scrap)d"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<field name="product_uom" string="Unit Of Measure" groups="product.group_uom" colspan="4"/>
<field name="product_uos_qty" groups="product.group_uos" on_change="onchange_uos_quantity(product_id, product_uos_qty, product_uos, product_uom)" colspan="4"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4"/>
<field name="product_packaging" groups="product.group_stock_packaging" domain="[('product_id','=',product_id)]" colspan="4"/>
</group>
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','&lt;&gt;','view')]" />
<field name="location_dest_id" domain="[('usage','=','internal')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4">
<separator string="Traceability" colspan="4" groups="stock.group_tracking_lot"/>
<field name="tracking_id" groups="stock.group_tracking_lot" colspan="3" />
<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" colspan="1"/>
<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)" colspan="3"/>
<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" colspan="1" />
</group>
<label string="" colspan="4"/>
<field name="state"/>
<group col="4" colspan="2">
<button name="action_cancel" states="assigned" string="_Cancel" type="object" icon="gtk-cancel"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/>
</group>
</form>
</field>
</page>
<page string="Additional Info">
<field name="type"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</page>
<page string="Notes">
<field colspan="4" name="note" nolabel="1"/>
</page>
</notebook>
</sheet>
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</form>
<data>
<xpath expr="/form/div[@class='oe_form_topbar']/button[@name='action_process']" position="replace">
<button name="action_process" states="assigned" string="Receive" type="object" icon="gtk-go-forward"/>
</xpath>
<xpath expr="/form/sheet/group/group/field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" colspan="4" string="Supplier"/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_form_sheet_width">
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
</div>
</xpath>
</data>
</field>
</record>
<record id="view_picking_in_search" model="ir.ui.view">
<field name="name">stock.picking.in.search</field>
<field name="model">stock.picking</field>
<field name="model">stock.picking.in</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Incoming Shipments">
@ -1278,7 +1087,7 @@
<record id="action_picking_tree4" model="ir.actions.act_window">
<field name="name">Incoming Shipments</field>
<field name="res_model">stock.picking</field>
<field name="res_model">stock.picking.in</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
@ -1306,61 +1115,12 @@
</record>
<menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_warehouse_mgmt" sequence="1"/>
<record id="view_picking_internal_search" model="ir.ui.view">
<field name="name">stock.picking.internal.search</field>
<field name="model">stock.picking</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Internal Picking List">
<group>
<filter icon="terp-check" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
<filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves" />
<separator orientation="vertical"/>
<field name="name"/>
<field name="origin"/>
<field name="stock_journal_id" widget="selection"/>
<field name="company_id" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_picking_tree6" model="ir.actions.act_window">
<field name="name">Internal Moves</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','internal')]</field>
<field name="context">{'default_type': 'internal', 'contact_display': 'partner_address', 'search_default_available': 1}</field>
<field name="search_view_id" ref="view_picking_internal_search"/>
<field name="help">Internal Moves display all inventory operations you have to perform in your warehouse. All operations can be categorized into stock journals, so that each worker has his own list of operations to perform in his own journal. Most operations are prepared automatically by OpenERP according to your preconfigured logistics rules, but you can also record manual stock operations.</field>
</record>
<record model="ir.actions.act_window.view" id="action_picking_tree6_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="vpicktree"/>
<field name="act_window_id" ref="action_picking_tree6"/>
</record>
<record model="ir.actions.act_window.view" id="action_picking_tree6_form_view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_picking_form"/>
<field name="act_window_id" ref="action_picking_tree6"/>
</record>
<!--
STOCK MOVES
-->
<menuitem action="action_picking_tree6" id="menu_action_picking_tree6" parent="menu_stock_warehouse_mgmt" sequence="2"/>

View File

@ -23,7 +23,7 @@
<act_window name="Create invoice"
res_model="stock.invoice.onshipping"
src_model="stock.picking"
src_model="stock.picking.out"
key2="client_action_multi"
multi="True"
view_mode="form"

View File

@ -76,24 +76,18 @@ class stock_partial_picking(osv.osv_memory):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:
context={}
# remove the entry with key 'form_view_ref', otherwise fields_view_get crashes
context.pop('form_view_ref', None)
res = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
type = context.get('default_type', False)
type = context.get('active_model','').split('.')[-1]
if type:
doc = etree.XML(res['arch'])
for node in doc.xpath("//group/button[@string='_Validate']"):
for node in doc.xpath("//group/button[@name='do_partial']"):
if type == 'in':
node.set('string', _('_Receive'))
elif type == 'internal':
node.set('string', _('_Transfer'))
elif type == 'out':
node.set('string', _('_Deliver'))
for node in doc.xpath("//separator[@string='Products']"):
for node in doc.xpath("//separator[@name='product_separator']"):
if type == 'in':
node.set('string', _('Receive Products'))
elif type == 'internal':
node.set('string', _('Transfer Products'))
elif type == 'out':
node.set('string', _('Deliver Products'))
res['arch'] = etree.tostring(doc)

View File

@ -16,7 +16,7 @@
<field name="arch" type="xml">
<form>
<field name="hide_tracking" invisible="1"/>
<separator colspan="4" string="Products"/>
<separator colspan="4" string="Transfer Products" name="product_separator"/>
<field name="move_ids" colspan="4" nolabel="1" mode="tree,form" width="550" height="200" context="{'hide_tracking': hide_tracking}">
<tree editable="bottom" string="Product Moves">
<field name="product_id" />
@ -34,7 +34,7 @@
<label string="" colspan="2"/>
<group col="2" colspan="2">
<button icon='gtk-cancel' special="cancel" string="_Cancel" />
<button name="do_partial" string="_Validate" colspan="1" type="object" icon="gtk-go-forward" />
<button name="do_partial" string="_Transfer" colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>

View File

@ -9,6 +9,22 @@
key2="client_action_multi"
multi="True"
id="act_stock_return_picking"/>
<act_window name="Return Shipment"
res_model="stock.return.picking"
src_model="stock.picking.in"
view_mode="form"
target="new"
key2="client_action_multi"
multi="True"
id="act_stock_return_picking_in"/>
<act_window name="Return Shipment"
res_model="stock.return.picking"
src_model="stock.picking.out"
view_mode="form"
target="new"
key2="client_action_multi"
multi="True"
id="act_stock_return_picking_out"/>
<record id="stock_return_memory_tree_in" model="ir.ui.view">
<field name="name">stock.return.picking.memory.tree</field>