~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to account_override/invoice.py

  • Committer: jf
  • Date: 2015-07-24 09:52:17 UTC
  • mfrom: (2551.1.2 us-286)
  • Revision ID: jfb@tempo-consulting.fr-20150724095217-lqyziqd3k7g5este
US-286 [FIX] Add checks on pick/pack/ship validation to block concurrent validation
lp:~unifield-team/unifield-wm/us-286

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
            # TODO: it's very bad to set a domain by onchange method, no time to rewrite UniField !
256
256
            res['domain']['journal_id'] = [('id', 'in', journal_ids)]
257
257
        return res
258
 
 
 
258
        
259
259
    def onchange_partner_id(self, cr, uid, ids, ctype, partner_id,\
260
260
        date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False, is_inkind_donation=False, is_intermission=False, is_debit_note=False, is_direct_invoice=False):
261
261
        """
485
485
        """
486
486
        Check document_date
487
487
        """
488
 
        if context is None:
 
488
        if not context:
489
489
            context = {}
490
490
        if isinstance(ids, (int, long)):
491
491
            ids = [ids]
492
 
 
493
 
        # US_286: Forbit possibility to add include price tax
494
 
        # in bottom left corner
495
 
        if 'tax_line' in vals:
496
 
            tax_obj = self.pool.get('account.tax')
497
 
            for tax_line in vals['tax_line']:
498
 
                if tax_line[2]:
499
 
                    if 'account_tax_id' in tax_line[2]:
500
 
                        args = [('price_include', '=', '1'),
501
 
                                ('id', '=', tax_line[2]['account_tax_id'])]
502
 
                        tax_ids = tax_obj.search(cr, uid, args, context=context)
503
 
                        if tax_ids:
504
 
                            raise osv.except_osv(_('Error'),
505
 
                                                 _('Tax included in price can not be tied to the whole invoice.'))
506
 
 
507
492
        res = super(account_invoice, self).write(cr, uid, ids, vals, context=context)
508
493
        self._check_document_date(cr, uid, ids)
509
494
        return res