~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to hr_expense_replenishment/model/hr_expense.py

  • Committer: Jose Morales
  • Date: 2014-07-28 20:00:11 UTC
  • mfrom: (543.7.551 7.0-addons-vauxoo)
  • Revision ID: jose@vauxoo.com-20140728200011-csytovehrzwp24lr
[FORWARD PORT] 7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1016
1016
            'datas': datas
1017
1017
        }
1018
1018
 
 
1019
    def action_receipt_create(self, cr, uid, ids, context=None):
 
1020
        '''
 
1021
        main function that is called when trying to create the accounting entries related to an expense
 
1022
        then this super tries to get rid of the Journal Entry Lines in zero
 
1023
        '''
 
1024
        super(hr_expense_expense, self).action_receipt_create(cr, uid, ids, context=context)
 
1025
        aml_obj = self.pool.get('account.move.line')
 
1026
        res = []
 
1027
        for exp in self.browse(cr, uid, ids, context=context):
 
1028
            if not exp.account_move_id.journal_id.entry_posted:
 
1029
                for aml_brw in exp.account_move_id.line_id:
 
1030
                    if not aml_brw.debit and not aml_brw.credit:
 
1031
                        res.append(aml_brw.id)
 
1032
        if res:
 
1033
            aml_obj.unlink(cr, uid, res, context=context)
 
1034
        return True
 
1035
 
1019
1036
class account_voucher(osv.Model):
1020
1037
    _inherit = 'account.voucher'
1021
1038
    def create(self, cr, uid, vals, context=None):