From c77e66bdc3e8b311efd295eb642082faf1713a6d Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 11 Jul 2013 17:00:23 +0200 Subject: [PATCH] [WIP] stock_account bzr revid: qdp-launchpad@openerp.com-20130711150023-sjian7my2r3t0x7l --- addons/stock/stock.py | 20 +------------------- addons/stock_account/stock_account.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 93d0f6e5adf..cb4c5ae1f7b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -586,7 +586,7 @@ class stock_picking(osv.osv): for pick in self.browse(cr, uid, ids, context=context): ids2 = [move.id for move in pick.move_lines] self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) - self.write(cr, uid, ids, {'state': 'cancel', 'invoice_state': 'none'}) + self.write(cr, uid, ids, {'state': 'cancel'}) return True # @@ -2058,24 +2058,6 @@ class stock_inventory(osv.osv): def action_cancel_inventory(self, cr, uid, ids, context=None): #TODO test self.action_cancel_draft(cr, uid, ids, context=context) - #""" Cancels both stock move and inventory - #@return: True - #""" - #move_obj = self.pool.get('stock.move') - #account_move_obj = self.pool.get('account.move') - #for inv in self.browse(cr, uid, ids, context=context): - # move_obj.action_cancel(cr, uid, [x.id for x in inv.move_ids], context=context) - # for move in inv.move_ids: - # account_move_ids = account_move_obj.search(cr, uid, [('name', '=', move.name)]) - # if account_move_ids: - # account_move_data_l = account_move_obj.read(cr, uid, account_move_ids, ['state'], context=context) - # for account_move in account_move_data_l: - # if account_move['state'] == 'posted': - # raise osv.except_osv(_('User Error!'), - # _('In order to cancel this inventory, you must first unpost related journal entries.')) - # account_move_obj.unlink(cr, uid, [account_move['id']], context=context) - # self.write(cr, uid, [inv.id], {'state': 'cancel'}, context=context) - #return True class stock_inventory_line(osv.osv): diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 5cb3ff3154c..0f63885e86e 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -315,6 +315,17 @@ class stock_picking(osv.osv): 'invoice_state': 'none', } + #TODO: we don't need to change invoice_state on cancelation, do we? + #def action_cancel(self, cr, uid, ids, context=None): + # """ Changes picking state to cancel. + # @return: True + # """ + # for pick in self.browse(cr, uid, ids, context=context): + # ids2 = [move.id for move in pick.move_lines] + # self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) + # self.write(cr, uid, ids, {'state': 'cancel', 'invoice_state': 'none'}) + # return True + def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {}