Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check invoice date in OpenERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 188
    Comment on it

    Step-1 Install the account_invoice_sequential_dates module.
    Step-2 Account_invoice_sequential_dates->invoice.py
    Step-3 After that custmozie invoice.py(Python file) file:
    In below example, I have custmozied invoice.py file. You can directly copy the below python code in your invoice.py file.

    import netsvc
    import pooler, tools
    
    from openerp.osv import fields, orm
    from tools.translate import _
    
    class account_invoice(orm.Model):
        _inherit = 'account.invoice'
    
        def action_number(self, cr, uid, ids, context=None):
            super(account_invoice, self).action_number(cr, uid, ids, context=context)
            for obj_inv in self.browse(cr, uid, ids, context=context):
                inv_type = obj_inv.type
                if inv_type == 'in_invoice' or inv_type == 'in_refund':
                    return True
                number = obj_inv.number
                date_invoice = obj_inv.date_invoice
                journal = obj_inv.journal_id.id
                res = self.search(cr, uid, [('type','=',inv_type),('date_invoice','>',date_invoice), 
                    ('number', '<', number), ('journal_id','=',journal)], context=context)
                if res:
                    raise orm.except_orm(_('Date Inconsistency'),
                            _('Cannot create invoice! Post the invoice with a greater date'))
            return True
    

 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: