~unifield-team/unifield-wm/wm-2418-rw-fix

« back to all changes in this revision

Viewing changes to analytic_distribution/wizard/analytic_distribution_wizard.py

  • Committer: pierre-marie
  • Date: 2012-07-25 15:04:47 UTC
  • mfrom: (1038 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 1059.
  • Revision ID: pierre-marie@pierre-marie-laptop-20120725150447-namc1a6lqi455ez2
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
441
441
            if el.accrual_line_id and el.accrual_line_id.state in ['posted']:
442
442
                res[el.id] = False
443
443
            # verify sale order state
444
 
            if el.sale_order_id and el.sale_order_id.state in ['done', 'manual', 'progress', 'shipping_except', 'invoice_except']:
 
444
            if el.sale_order_id and el.sale_order_id.state in ['done', 'manual', 'progress', 'shipping_except', 'invoice_except', 'sourced']:
445
445
                res[el.id] = False
446
446
            # verify sale order line state
447
 
            if el.sale_order_line_id and el.sale_order_line_id.order_id and el.sale_order_line_id.order_id.state in ['done', 'manual', 'progress', 'shipping_except', 'invoice_except']:
 
447
            if el.sale_order_line_id and el.sale_order_line_id.order_id and el.sale_order_line_id.order_id.state in ['done', 'manual', 'progress', 'shipping_except', 'invoice_except', 'sourced']:
448
448
                res[el.id] = False
449
449
        return res
450
450
 
857
857
            ids = [ids]
858
858
        for wiz in self.browse(cr, uid, ids, context=context):
859
859
            # Then update cost center lines
860
 
            if not self.update_cost_center_lines(cr, uid, wiz.id, context=context):
861
 
                raise osv.except_osv(_('Error'), _('Cost center update failure.'))
 
860
            #if not self.update_cost_center_lines(cr, uid, wiz.id, context=context):
 
861
            #    raise osv.except_osv(_('Error'), _('Cost center update failure.'))
862
862
            # First do some verifications before writing elements
863
863
            self.wizard_verifications(cr, uid, wiz.id, context=context)
864
864
            # And do distribution creation if necessary
1015
1015
                distrib = pl.commit_id and pl.commit_id.analytic_distribution_id or False
1016
1016
 
1017
1017
            if distrib:
 
1018
                # Check if distribution if valid with wizard account
 
1019
                if wiz.account_id:
 
1020
                    if self.pool.get('analytic.distribution')._get_distribution_state(cr, uid, distrib.id, False, wiz.account_id.id) != 'valid':
 
1021
                        raise osv.except_osv(_('Warning'), _('Header distribution is not valid with this line. Please create a new one here.'))
1018
1022
                # First delete all current lines
1019
1023
                self.pool.get('analytic.distribution.wizard.lines').unlink(cr, uid, [x.id for x in wiz.line_ids], context=context)
1020
1024
                self.pool.get('analytic.distribution.wizard.fp.lines').unlink(cr, uid, [x.id for x in wiz.fp_line_ids], context=context)