[IMP] sale: while canceling sale order line display msg if pickings are confirm

[IMP] stock: stock picking

bzr revid: mra@mra-laptop-20100720130223-pondu6rsgsyprocx
This commit is contained in:
mtr (Open ERP) 2010-07-20 18:32:23 +05:30 committed by Mustufa Rangwala
parent e89b48999c
commit 90234707dc
3 changed files with 9 additions and 10 deletions

View File

@ -659,7 +659,6 @@ class sale_order(osv.osv):
'invoice_state': (order.order_policy=='picking' and '2binvoiced') or 'none',
'company_id': order.company_id.id,
})
move_id = self.pool.get('stock.move').create(cr, uid, {
'name': line.name[:64],
'picking_id': picking_id,
@ -721,7 +720,6 @@ class sale_order(osv.osv):
val['state'] = 'manual'
break
self.write(cr, uid, [order.id], val)
return True
def action_ship_end(self, cr, uid, ids, context=None):
@ -941,10 +939,11 @@ class sale_order_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context):
if line.invoiced:
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced !'))
# if line.order_id.picking_ids:
# raise osv.except_osv(
# _('Could not cancel sale order line!'),
# _('You must first cancel stock move attached to this sale order line.'))
for pick in line.order_id.picking_ids:
if pick.state != 'cancel':
raise osv.except_osv(
_('Could not cancel sale order line!'),
_('You must first cancel all pickings attached with sale order.'))
message = _('Sale order line') + " '" + line.name + "' "+_("is cancelled")
self.log(cr, uid, id, message)
return self.write(cr, uid, ids, {'state': 'cancel'})

View File

@ -1591,8 +1591,9 @@ class stock_move(osv.osv):
'stock_journal_id': todo[0][1][3],
'company_id': todo[0][1][4] or res_obj._company_default_get(cr, uid, 'stock.company', context),
'address_id': picking.address_id.id,
'invoice_state': 'none'
'invoice_state': 'none',
'date': picking.date,
'sale_id': picking.sale_id.id
})
for move, (loc, auto, delay, journal, company_id, ptype) in todo:
new_id = self.pool.get('stock.move').copy(cr, uid, move.id, {

View File

@ -894,9 +894,9 @@
<field name="auto_picking"/>
<field name="active"/>
<newline/>
<field name="date"/>
<field name="date_done"/>
<field name="move_type"/>
<field name="sale_id"/>
</page>
</notebook>
</form>
@ -1093,7 +1093,6 @@
<field name="active"/>
<field name="auto_picking"/>
<newline/>
<field name="date"/>
<field name="date_done"/>
<field name="move_type"/>
</page>