Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to each product partial reconciliation in OpenERP(Odoo)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 726
    Comment on it

    In OpenERP first, create custom module and than override the function in .py file in custom module  and pass this file to the __init__.py file. Then get the correct line residual amount  and pass this line in account invoice. using this function product_residual and this function residual amount between all invoice.

    Using this function given below

    def product_residual(self, cr, uid, ids, context=None):
            self.residual = 0.0
            partial_reconciliations_done = []
            for line in self.sudo().move_id.line_id:
                if line.account_id.type not in ('receivable', 'payable'):
                    continue
                if line.reconcile_partial_id and line.reconcile_partial_id.id in partial_reconciliations_done:
                    continue
                # Get the correct line residual amount
                if line.currency_id == self.currency_id:
                    line_amount = line.amount_residual_currency if line.currency_id else line.amount_residual
                else:
                    from_currency = line.company_id.currency_id.with_context(date=line.date)
                    line_amount = from_currency.compute(line.amount_residual, self.currency_id)
                # For partially reconciled lines, split the residual amount
                if line.reconcile_partial_id:
                    partial_reconciliation_invoices = set()
                    for pline in line.reconcile_partial_id.line_partial_ids:
                        if pline.invoice and self.type == pline.invoice.type:
                            partial_reconciliation_invoices.update([pline.invoice.id])
                    line_amount = self.currency_id.round(line_amount / len(partial_reconciliation_invoices))
                    partial_reconciliations_done.append(line.reconcile_partial_id.id)
                self.residual += line_amount
            self.residual = max(self.residual, 0.0)
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: