~camptocamp/openobject-addons/6.1-c2c-official

« back to all changes in this revision

Viewing changes to account/account_move_line.py

  • Committer: Vincent Renaville
  • Date: 2014-05-13 12:29:18 UTC
  • Revision ID: vincent.renaville@camptocamp.com-20140513122918-fb0q05egogh5qyp8
=[FIX] addons 6.1 rev 7295 rev-id odo@openerp.com-20140110154023-12rqfeuwx5fqpdau : see bug lp:1215897

Show diffs side-by-side

added added

removed removed

Lines of Context:
844
844
                   (tuple(ids), ))
845
845
        r = cr.fetchall()
846
846
        #TODO: move this check to a constraint in the account_move_reconcile object
 
847
        if len(r) != 1:
 
848
            raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! '))
847
849
        if not unrec_lines:
848
850
            raise osv.except_osv(_('Error'), _('Entry is already reconciled'))
849
851
        account = account_obj.browse(cr, uid, account_id, context=context)
 
852
        if not account.reconcile:
 
853
            raise osv.except_osv(_('Error'), _('The account is not defined to be reconciled !'))
850
854
        if r[0][1] != None:
851
855
            raise osv.except_osv(_('Error'), _('Some entries are already reconciled !'))
852
856
 
853
 
        if context.get('fy_closing'):
854
 
            # We don't want to generate any write-off when being called from the
855
 
            # wizard used to close a fiscal year (and it doesn't give us any
856
 
            # writeoff_acc_id).
857
 
            pass
858
 
        elif (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
 
857
        if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
859
858
           (account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
860
859
            if not writeoff_acc_id:
861
860
                raise osv.except_osv(_('Warning'), _('You have to provide an account for the write off/exchange difference entry !'))