Alessandro Camilli has proposed merging
lp:~a-camilli/openobject-italia/6.1-fix-controllo-data-registrazione-consecutiva
into lp:openobject-italia/6.1.
Requested reviews:
OpenERP Italia core devs (openobject-italia-core-devs)
For more details, see:
https://code.launchpad.net/~a-camilli/openobject-italia/6.1-fix-controllo-data-registrazione-consecutiva/+merge/162563
Controllo consecutività data registrazione fattura
--
https://code.launchpad.net/~a-camilli/openobject-italia/6.1-fix-controllo-data-registrazione-consecutiva/+merge/162563
Your team OpenERP Italia core devs is requested to review the proposed merge of
lp:~a-camilli/openobject-italia/6.1-fix-controllo-data-registrazione-consecutiva
into lp:openobject-italia/6.1.
=== modified file 'account_invoice_entry_date/invoice.py'
--- account_invoice_entry_date/invoice.py 2011-09-09 08:48:18 +0000
+++ account_invoice_entry_date/invoice.py 2013-05-06 07:29:27 +0000
@@ -49,6 +49,22 @@
if (date_invoice > reg_date) :
raise osv.except_osv(_('Error date !'), _('The invoice date cannot be later than the date of registration!'))
+ # Consecutività nr fattura/data
+ statement_internal_number = ""
+ if inv.internal_number :
+ statement_internal_number = " AND name > '%s'" % (inv.internal_number,)
+ cr.execute('SELECT date,name FROM account_move ' \
+ 'WHERE journal_id=%s AND state = %s' \
+ 'AND period_id=%s ' + statement_internal_number + ' '\
+ 'ORDER BY name limit 1' ,
+ (inv.journal_id.id, 'posted', inv.period_id.id))
+ move = cr.fetchone()
+ if move and len(move) > 0 :
+ date_last = move[0]
+ name_last = move[1]
+ if reg_date < date_last :
+ raise osv.except_osv(_('Error !'), _('Date entry not consecutive. The last invoice is : %s %s') % (name_last, date_last))
+
#periodo
date_start = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
date_stop = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
_______________________________________________
Mailing list: https://launchpad.net/~openobject-italia-core-devs
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openobject-italia-core-devs
More help : https://help.launchpad.net/ListHelp