diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 708a35d4351..687221f371b 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -442,9 +442,9 @@ class purchase_order(osv.osv):
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'),
'origin': order.name + ((order.origin and (':' + order.origin)) or ''),
'date': order.date_order,
+ 'type': 'in',
'partner_id': order.dest_address_id.id or order.partner_id.id,
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
- 'type': 'in',
'purchase_id': order.id,
'company_id': order.company_id.id,
'move_lines' : [],
diff --git a/addons/purchase/stock_view.xml b/addons/purchase/stock_view.xml
index 11a3b1575f5..f29783c67ae 100644
--- a/addons/purchase/stock_view.xml
+++ b/addons/purchase/stock_view.xml
@@ -19,7 +19,7 @@
-
+
@@ -30,7 +30,7 @@
name="Receptions"
res_model="stock.picking"
src_model="purchase.order"
- context="{'default_purchase_id': active_id, 'contact_display': 'partner', 'default_type': 'in'}" />
+ context="{'default_purchase_id': active_id, 'contact_display': 'partner'}" />
@@ -51,9 +51,9 @@
form
-
+
-
+
@@ -67,8 +67,8 @@
-
+
@@ -89,7 +89,7 @@
- If you set the Invoicing Control on a purchase order as "Based on receptions", you can track here all the product receptions and create invoices for those receptions.
-
-
- tree
-
-
-
-
-
- form
-
-
-
-
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 9e2f9280f47..847e2e8f463 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -246,21 +246,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index 102d54ae9ed..88ddead6645 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -72,8 +72,8 @@ Thanks to the double entry management, the inventory controlling is powerful and
'wizard/stock_return_picking_view.xml',
"stock_workflow.xml",
"stock_incoterms.xml",
- "stock_report.xml",
"stock_view.xml",
+ "stock_report.xml",
"stock_sequence.xml",
"product_data.xml",
"product_view.xml",
diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml
index 21fa3407e26..63706a940e6 100644
--- a/addons/stock/report/picking.rml
+++ b/addons/stock/report/picking.rml
@@ -1,6 +1,6 @@
-
+
@@ -31,6 +31,7 @@
+
@@ -51,12 +52,14 @@
+
+
@@ -158,9 +161,7 @@
- Supplier Address : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]]
- Customer Address : [[ (picking.type == 'out' or removeParentNode('para')) and '' ]]
- Warehouse Address : [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]]
+ Shipping Address :[[ (picking.partner_id and picking.partner_id.id and picking.partner_id.title.name) or '' ]] [[ picking.partner_id and picking.partner_id.id and picking.partner_id.name ]][[ picking.partner_id and display_address(picking.partner_id,'delivery') ]]
@@ -180,16 +181,16 @@
- Delivery Order : [[ (picking.type == 'out' or removeParentNode('para')) and '' ]] [[ picking.name ]]
- Incoming Shipment : [[ (picking.type == 'in' or removeParentNode('para')) and '' ]] [[ picking.name ]]
- Internal Shipment : [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]] [[ picking.name ]]
+ Packing List: [[ (picking.type == 'out' or removeParentNode('para')) and '' ]] [[ picking.name ]]
+ Reception: [[ (picking.type == 'in' or removeParentNode('para')) and '' ]] [[ picking.name ]]
+ Picking List: [[ (picking.type == 'internal' or removeParentNode('para')) and '' ]] [[ picking.name ]]
-
+
Journal
@@ -208,7 +209,7 @@
-
+
[[ picking.stock_journal_id.name]]
@@ -239,7 +240,7 @@
Lot
- State
+ State
Location
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
index bdd094b7233..da6be7873c3 100644
--- a/addons/stock/report/report_stock_move.py
+++ b/addons/stock/report/report_stock_move.py
@@ -38,7 +38,7 @@ class report_stock_move(osv.osv):
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
- 'picking_id':fields.many2one('stock.picking', 'Shipment', readonly=True),
+ 'picking_id':fields.many2one('stock.picking', 'Packing', readonly=True),
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('other', 'Others')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'location_id': fields.many2one('stock.location', 'Source Location', readonly=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', readonly=True, select=True, help="Location where the system will stock the finished products."),
diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml
index 967ac202d2e..01ef4a70289 100644
--- a/addons/stock/report/report_stock_move_view.xml
+++ b/addons/stock/report/report_stock_move_view.xml
@@ -117,7 +117,7 @@
-
+
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 57e12c7f0b8..dee8e2a6c25 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -19,7 +19,6 @@
#
##############################################################################
-from lxml import etree
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
@@ -535,14 +534,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']
@@ -614,19 +605,6 @@ class stock_picking(osv.osv):
res[pick]['min_date'] = dt1
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')=='/'):
@@ -638,33 +616,46 @@ class stock_picking(osv.osv):
return new_id
_columns = {
- 'name': fields.char('Reference', size=64, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
- 'origin': fields.char('Origin', size=64, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Reference of the document", select=True),
- 'backorder_id': fields.many2one('stock.picking', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
- 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Shipping type specify, goods coming in or going out."),
- 'note': fields.text('Notes', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
- 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
- 'location_id': fields.many2one('stock.location', 'Location', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Keep empty if you produce at the location where the finished products are needed." \
+ 'name': fields.char('Reference', size=64, select=True),
+ 'origin': fields.char('Origin', size=64, help="Reference of the document that produced this picking.", select=True),
+ 'backorder_id': fields.many2one('stock.picking', 'Back Order of', help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True),
+ 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
+ 'note': fields.text('Notes'),
+ 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
+ 'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \
"Set a location if you produce at a fixed location. This can be a partner location " \
"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),
+ 'location_dest_id': fields.many2one('stock.location', 'Dest. Location',help="Location where the system will stock the finished products.", select=True),
+ 'move_type': fields.selection([('direct', 'Partial Delivery'), ('one', 'All at once')], 'Delivery Method', required=True, help="It specifies goods to be delivered all at once or by direct delivery"),
+ 'state': fields.selection([
+ ('draft', 'New'),
+ ('auto', 'Waiting Another Operation'),
+ ('confirmed', 'Waiting Availability'),
+ ('assigned', 'Ready to Process'),
+ ('done', 'Done'),
+ ('cancel', 'Cancelled'),
+ ], 'State', readonly=True, select=True,
+ help="* Draft: not confirmed yet and will not be scheduled until confirmed\n"\
+ "* Confirmed: still waiting for the availability of products\n"\
+ "* Available: products reserved, simply waiting for confirmation.\n"\
+ "* Waiting: waiting for another move to proceed before it becomes automatically available (e.g. in Make-To-Order flows)\n"\
+ "* Done: 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)]}),
- 'date_done': fields.datetime('Date Done', help="Date of Completion", states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
+ store=True, type='datetime', string='Expected Date', select=1, help="Expected date for the picking to be processed"),
+ 'date': fields.datetime('Order Date', help="Date of Order", select=True),
+ 'date_done': fields.datetime('Date Done', help="Date of Completion"),
'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date",
store=True, type='datetime', string='Max. Expected Date', select=2),
'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
- 'auto_picking': fields.boolean('Auto-Picking', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
- 'partner_id': fields.many2one('res.partner', 'Partner', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
+ 'auto_picking': fields.boolean('Auto-Picking'),
+ 'partner_id': fields.many2one('res.partner', 'Partner'),
'invoice_state': fields.selection([
("invoiced", "Invoiced"),
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")], "Invoice Control",
select=True, required=True, readonly=True, states={'draft': [('readonly', False)]}),
- 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
}
_defaults = {
'name': lambda self, cr, uid, context: '/',
@@ -678,82 +669,23 @@ 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 })
+ context = dict(context, active_ids=ids, active_model=self._name)
+ partial_id = self.pool.get("stock.partial.picking").create(cr, uid, {}, context=context)
return {
- 'view_type': 'form',
+ 'name':_("Products to Process"),
'view_mode': 'form',
+ 'view_id': False,
+ 'view_type': 'form',
'res_model': 'stock.partial.picking',
- 'views': [(resource_id,'form')],
- 'view_id': resource_id,
+ 'res_id': partial_id,
'type': 'ir.actions.act_window',
- 'target': 'new',
- 'context': ctx,
'nodestroy': True,
+ 'target': 'new',
+ 'domain': '[]',
+ 'context': context,
}
def copy(self, cr, uid, id, default=None, context=None):
@@ -807,10 +739,7 @@ class stock_picking(osv.osv):
""" Changes state of picking to available if all moves are confirmed.
@return: True
"""
- wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids):
- if pick.state == 'draft':
- wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_confirm', cr)
move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed']
if not move_ids:
raise osv.except_osv(_('Warning !'),_('Not enough stock, unable to reserve the products.'))
@@ -893,9 +822,6 @@ class stock_picking(osv.osv):
for pick in self.browse(cr, uid, ids):
mt = pick.move_type
for move in pick.move_lines:
- # incomming shipments are always set as available
- if pick.type == 'in':
- return True
if (move.state in ('confirmed', 'draft')) and (mt == 'one'):
return False
if (mt == 'direct') and (move.state == 'assigned') and (move.product_qty):
@@ -1613,14 +1539,6 @@ stock_production_lot_revision()
# Fields:
# location_dest_id is only used for predicting futur stocks
#
-MOVE_STATE = [
- ('draft', 'Draft'),
- ('waiting', 'Waiting Another Move'),
- ('confirmed', 'Waiting Availability'),
- ('assigned', 'Available'),
- ('done', 'Done'),
- ('cancel', 'Cancelled')
-]
class stock_move(osv.osv):
def _getSSCC(self, cr, uid, context=None):
@@ -1684,17 +1602,6 @@ class stock_move(osv.osv):
return False
return True
- def _tooltip_move_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 = MOVE_STATE
- _tooltip_state_assigned = state.get('assigned', False)
- _tooltip_state_done = state.get('done', False)
- return _("* Draft: When the stock move is created it is in the \'Draft\' state.\n"\
- "* Waiting Another Move: it is set to \'Waiting Another Move\' state if the scheduler did not find the products.\n"\
- "* Waiting Availability: The state is \'Waiting Availability\' if the move is waiting for another one.\n"\
- "* %s: When products are reserved it is set to \'%s\'.\n"\
- "* %s: When the shipment is done the state is \'%s\'.") % (_tooltip_state_assigned, _tooltip_state_assigned, _tooltip_state_done, _tooltip_state_done)
_columns = {
'name': fields.char('Name', size=250, required=True, select=True),
'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
@@ -1723,12 +1630,9 @@ class stock_move(osv.osv):
'move_history_ids2': fields.many2many('stock.move', 'stock_move_history_ids', 'child_id', 'parent_id', 'Move History (parent moves)'),
'picking_id': fields.many2one('stock.picking', 'Reference', select=True,states={'done': [('readonly', True)]}),
'note': fields.text('Notes'),
- 'state': fields.selection(MOVE_STATE, 'State', readonly=True, select=True,
- help= "* Draft: When the stock move is created it is in the \'Draft\' state.\n"\
- "* Waiting Another Move: it is set to \'Waiting Another Move\' state if the scheduler did not find the products.\n"\
- "* Waiting Availability: The state is \'Waiting Availability\' if the move is waiting for another one.\n"\
- "* Available: When products are reserved it is set to \'Available\'.\n"\
- "* Done: When the shipment is done the state is \'Done\'."),
+ 'state': fields.selection([('draft', 'New'), ('waiting', 'Waiting Another Move'), ('confirmed', 'Waiting Availability'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
+ help='When the stock move is created it is in the \'Draft\' state.\n After that, it is set to \'Not Available\' state if the scheduler did not find the products.\n When products are reserved it is set to \'Available\'.\n When the picking is done the state is \'Done\'.\
+ \nThe state is \'Waiting\' if the move is waiting for another one.'),
'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Account'), help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),
'price_currency_id': fields.many2one('res.currency', 'Currency for average price', help="Technical field used to record the currency chosen by the user during a picking confirmation (when average price costing method is used)"),
'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
@@ -1754,38 +1658,6 @@ class stock_move(osv.osv):
'You try to assign a lot which is not from the same product',
['prodlot_id'])]
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- if context is None:
- context = {}
- type = context.get('default_type', False)
- res = super(stock_move, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
- if type:
- doc = etree.XML(res['arch'])
- if type == 'out':
- #To Update button label in case of shipping type is out
- if view_type == 'tree':
- for node in doc.xpath("//button[@string='Receive']"):
- node.set('string', _('Deliver'))
- for node in doc.xpath("//group/button[@string='Process Now']"):
- node.set('string', _('Deliver'))
- for field in res['fields']:
- # To update the states label according to shipping type
- if field == 'state':
- _state = dict(MOVE_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 MOVE_STATE]
- res['fields']['state']['help'] = self._tooltip_move_state(_state)
- res['arch'] = etree.tostring(doc)
- return res
-
def _default_location_destination(self, cr, uid, context=None):
""" Gets default address of partner for destination location
@return: Address id or False
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index ea4433d98f9..95d0acd853d 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -691,20 +691,7 @@
form
-
+
+
+
+
+
+
+
+
+
+
@@ -820,7 +817,6 @@
-
@@ -885,21 +881,7 @@
stock.pickingform
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1002,6 +984,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -1014,10 +1007,7 @@
-
-
-
@@ -1110,21 +1100,7 @@
stock.pickingform
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1225,6 +1201,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -1234,10 +1221,7 @@
-
-
-
diff --git a/addons/stock/stock_workflow.xml b/addons/stock/stock_workflow.xml
index d2e905a2789..14b5babdea8 100644
--- a/addons/stock/stock_workflow.xml
+++ b/addons/stock/stock_workflow.xml
@@ -51,12 +51,11 @@
button_confirm
-
not test_assigned()
-
+
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index d3e50968d90..6f815413497 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -20,7 +20,6 @@
##############################################################################
import time
-from lxml import etree
from osv import fields, osv
from tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
import decimal_precision as dp
@@ -72,32 +71,6 @@ class stock_partial_picking(osv.osv_memory):
'picking_id': fields.many2one('stock.picking', 'Picking', required=True, ondelete='CASCADE'),
'hide_tracking': fields.function(_hide_tracking, string='Tracking', type='boolean', help='This field is for internal purpose. It is used to decide if the column prodlot has to be shown on the move_ids field or not'),
}
-
- 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)
- if type:
- doc = etree.XML(res['arch'])
- for node in doc.xpath("//group/button[@string='_Validate']"):
- 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']"):
- 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)
- return res
def default_get(self, cr, uid, fields, context=None):
if context is None: context = {}
@@ -138,7 +111,7 @@ class stock_partial_picking(osv.osv_memory):
def _partial_move_for(self, cr, uid, move):
partial_move = {
'product_id' : move.product_id.id,
- 'quantity' : move.state in ('assigned','draft','confirmed') and move.product_qty or 0,
+ 'quantity' : move.state in ('assigned','new') and move.product_qty or 0,
'product_uom' : move.product_uom.id,
'prodlot_id' : move.prodlot_id.id,
'move_id' : move.id,
diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py
index a82a7442eed..689f17cd9b9 100644
--- a/addons/stock/wizard/stock_return_picking.py
+++ b/addons/stock/wizard/stock_return_picking.py
@@ -45,7 +45,7 @@ class stock_return_picking(osv.osv_memory):
_columns = {
'product_return_moves' : fields.one2many('stock.return.picking.memory', 'wizard_id', 'Moves'),
'invoice_state': fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], 'Invoicing',required=True),
- }
+ }
def default_get(self, cr, uid, fields, context=None):
"""
@@ -143,8 +143,6 @@ class stock_return_picking(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
uom_obj = self.pool.get('product.uom')
data_obj = self.pool.get('stock.return.picking.memory')
- act_obj = self.pool.get('ir.actions.act_window')
- model_obj = self.pool.get('ir.model.data')
wf_service = netsvc.LocalService("workflow")
pick = pick_obj.browse(cr, uid, record_id, context=context)
data = self.read(cr, uid, ids[0], context=context)
@@ -154,20 +152,15 @@ class stock_return_picking(osv.osv_memory):
returned_lines = 0
# Create new picking for returned products
- if pick.type =='out':
+ if pick.type=='out':
new_type = 'in'
- elif pick.type =='in':
+ elif pick.type=='in':
new_type = 'out'
else:
new_type = 'internal'
- new_picking = pick_obj.copy(cr, uid, pick.id, {
- 'name':'%s-return' % pick.name,
- 'move_lines': [],
- 'state':'draft',
- 'type': new_type,
- 'date':date_cur,
- 'invoice_state': data['invoice_state'],
- })
+ new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-return' % pick.name,
+ 'move_lines':[], 'state':'draft', 'type':new_type,
+ 'date':date_cur, 'invoice_state':data['invoice_state'],})
val_id = data['product_return_moves']
for v in val_id:
@@ -185,34 +178,40 @@ class stock_return_picking(osv.osv_memory):
if new_qty:
returned_lines += 1
new_move=move_obj.copy(cr, uid, move.id, {
- 'product_qty': new_qty,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id, new_qty, move.product_uos.id),
- 'picking_id':new_picking,
- 'state': 'draft',
- 'location_id': new_location,
- 'location_dest_id': move.location_id.id,
- 'date': date_cur,
- })
- move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]}, context=context)
+ 'product_qty': new_qty,
+ 'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
+ new_qty, move.product_uos.id),
+ 'picking_id':new_picking, 'state':'draft',
+ 'location_id':new_location, 'location_dest_id':move.location_id.id,
+ 'date':date_cur,})
+ move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
if not returned_lines:
raise osv.except_osv(_('Warning !'), _("Please specify at least one non-zero quantity!"))
if set_invoice_state_to_none:
- pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'}, context=context)
+ pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
# Update view id in context, lp:702939
- action_list = {
- 'out': 'action_picking_tree',
- 'in': 'action_picking_tree4',
- 'internal': 'action_picking_tree6',
+ view_list = {
+ 'out': 'view_picking_out_tree',
+ 'in': 'view_picking_in_tree',
+ 'internal': 'vpicktree',
+ }
+ data_obj = self.pool.get('ir.model.data')
+ res = data_obj.get_object_reference(cr, uid, 'stock', view_list.get(new_type, 'vpicktree'))
+ context.update({'view_id': res and res[1] or False})
+ return {
+ 'domain': "[('id', 'in', ["+str(new_picking)+"])]",
+ 'name': 'Picking List',
+ 'view_type':'form',
+ 'view_mode':'tree,form',
+ 'res_model':'stock.picking',
+ 'type':'ir.actions.act_window',
+ 'context':context,
}
- res = model_obj.get_object_reference(cr, uid, 'stock', action_list.get(new_type, 'action_picking_tree6'))
- id = res and res[1] or False
- result = act_obj.read(cr, uid, [id], context=context)[0]
- result['domain'] = "[('id', 'in', ["+str(new_picking)+"])]"
- return result
stock_return_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/wizard/stock_return_picking_view.xml b/addons/stock/wizard/stock_return_picking_view.xml
index 0e283797efe..51431eeee45 100644
--- a/addons/stock/wizard/stock_return_picking_view.xml
+++ b/addons/stock/wizard/stock_return_picking_view.xml
@@ -1,7 +1,7 @@
-