Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to copy invoice automatically in OpenERP(Odoo)?

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.11k
    Comment on it

    Step-1 install the account_invoice_copy module.
    Step-2 After that customize .py file in account_invoice_copy module.
    In below example, I have custmozied .py file. You can directly copy the below python code in your .py file -

     
        def copy(self, cr, uid, id, default=None, context=None):
            default = default or {}
            default.update({
                'state':'draft',
                'number':False,
                'move_id':False,
                'move_name':False,
                'internal_number': False,
                'period_id': False,
            })
            if 'date_invoice' not in default:
                default.update({
                    'date_invoice':False
                })
            if 'date_due' not in default:
                default.update({
                    'date_due':False
                }) 
    
    
            foo = self.browse(cr,uid,id)    
    #        raise osv.except_osv('Object Error', 'Doc %s ' % str(foo.file_ids))
    
    #        doc = self.pool.get('ir.attachement').search(cr,uid,foo.file_ids)
    #        raise osv.except_osv('Object Error', 'Doc %s %s' % str(doc,foo.file_ids))
            if context is None:
              context = {}
            context = context.copy()
            data = self.copy_data(cr, uid, id, default, context)
            new_id = self.create(cr, uid, data, context)
            self.copy_translations(cr, uid, id, new_id, context)
            return new_id
            return super(account_invoice, self).copy(cr, uid, id, default, context)
    
    
    account_invoice()
    

 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: