merge rpa branch
authorHarshad Modi <hmo@tinyerp.com>
Thu, 6 Nov 2008 15:31:23 +0000 (21:01 +0530)
committerHarshad Modi <hmo@tinyerp.com>
Thu, 6 Nov 2008 15:31:23 +0000 (21:01 +0530)
bzr revid: hmo@tinyerp.com-20081106153123-f924v8mq4faa5ybg

1  2 
addons/account/wizard/wizard_account_balance_report.py
addons/mrp/mrp.py

@@@ -54,7 -54,7 +54,7 @@@ period_fields = 
          'string':"Date/Period Filter",
          'type':'selection',
          'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
 -        'default': lambda *a:'bydate'
 +        'default': lambda *a:'none'
      },
      'fiscalyear': {
          'string':'Fiscal year',
@@@ -63,8 -63,8 +63,8 @@@
          'help':'Keep empty for all open fiscal year'
      },
      'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
-     'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With Movements'),('bal_solde','With Balance != 0'),('bal_all','All')]},
-     'date_from': {'string':"          Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
+     'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
+     'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
      'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
  }
  
@@@ -89,7 -89,6 +89,7 @@@ class wizard_report(wizard.interface)
          periods_obj=pooler.get_pool(cr.dbname).get('account.period')
          data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
          data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
 +        data['form']['fiscalyear'] = False
          data['form']['display_account']='bal_all'
          return data['form']
  
diff --combined addons/mrp/mrp.py
@@@ -1,7 -1,7 +1,7 @@@
  # -*- encoding: utf-8 -*-
  ##############################################################################
  #
 -#    OpenERP, Open Source Management Solution    
 +#    OpenERP, Open Source Management Solution
  #    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
  #    $Id$
  #
@@@ -771,6 -771,18 +771,18 @@@ class mrp_procurement(osv.osv)
          'close_move': lambda *a: 0,
          'procure_method': lambda *a: 'make_to_order',
      }
+      
+     def unlink(self, cr, uid, ids):
+         procurements = self.read(cr, uid, ids, ['state'])
+         unlink_ids = []
+         for s in procurements:
+             if s['state'] in ['draft','cancel']:
+                 unlink_ids.append(s['id'])
+             else:
+                 raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state']))
+         osv.osv.unlink(self, cr, uid, unlink_ids)
+         return True
+     
      def onchange_product_id(self, cr, uid, ids, product_id, context={}):
          if product_id:
              w=self.pool.get('product.product').browse(cr,uid,product_id, context)
@@@ -1211,7 -1223,7 +1223,7 @@@ class StockPicking(osv.osv)
      # Explode picking by replacing phantom BoMs
      #
      def action_explode(self, cr, uid, picks, *args):
 -        for move in picks:
 +        for move in self.pool.get('stock.move').browse(cr, uid, picks):
              self.pool.get('stock.move')._action_explode(cr, uid, move)
          return picks