Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to amount residual in account module in OpenERP(Odoo-8)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 761
    Comment on it

    In OpenERP first we create custom module and module name is account_demo and then create four file like as,,, account_demo.xml file in your module and create function and function name like accoutss_residual.

    The residual amount on a receivable or payable account.move.line will be returned by this function but by default an amount in the currency of this journal will be returned by it.

    And than when later on if you passed 'residual_in_company_currency' = True in the context then the returned amount will be in company currency.

    Using this code given below

     def accoutss_residual(self, cr, uid, ids, field_names, args, context=None):
            res = {}
            if context is None:
                context = {}
            cur_obj = self.pool.get('res.currency')
            for move_line in self.browse(cr, uid, ids, context=context):
                res[] = {
                    'amount_residual': 0.0,
                    'amount_residual_currency': 0.0,
                if move_line.reconcile_id:
                if not move_line.account_id.reconcile:
                if move_line.currency_id:
                    move_line_total = move_line.amount_currency
                    sign = move_line.amount_currency < 0 and -1 or 1
                    move_line_total = move_line.debit -
                    sign = (move_line.debit - < 0 and -1 or 1
                line_total_in_company_currency =  move_line.debit -
                context_unreconciled = context.copy()
                if move_line.reconcile_partial_id:
                    for payment_line in move_line.reconcile_partial_id.line_partial_ids:
                        if ==
                        if payment_line.currency_id and move_line.currency_id and ==
                                move_line_total += payment_line.amount_currency
                            if move_line.currency_id:
                                amount_in_foreign_currency = cur_obj.compute(cr, uid,,, (payment_line.debit -, round=False, context=context_unreconciled)
                                move_line_total += amount_in_foreign_currency
                                move_line_total += (payment_line.debit -
                        line_total_in_company_currency += (payment_line.debit -
                result = round(move_line_total)
                res[]['amount_residual_currency'] =  sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id, result) or result)
                res[]['amount_residual'] = sign * line_total_in_company_currency
            return res


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: