Merge lp:~icsergio/openobject-italia/61_fix_date_invoice_check into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1

Proposed by Sergio Corato
Status: Merged
Merged at revision: 242
Proposed branch: lp:~icsergio/openobject-italia/61_fix_date_invoice_check
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1
Diff against target: 67 lines (+12/-11)
3 files modified
l10n_it_account/AUTHORS.txt (+1/-0)
l10n_it_account/__openerp__.py (+1/-1)
l10n_it_account/account/invoice.py (+10/-10)
To merge this branch: bzr merge lp:~icsergio/openobject-italia/61_fix_date_invoice_check
Reviewer Review Type Date Requested Status
Lorenzo Battistini code review Approve
Review via email: mp+196993@code.launchpad.net

Description of the change

Registration data of supplier' invoices is checked only on the current period: with this branch it'll be checked on all the periods belonging to the relative fy.

To post a comment you must log in.
Revision history for this message
Sergio Corato (icsergio) wrote :

Some check made with flake8.

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Lorenzo Battistini (elbati) wrote :

The 'action_number' method of account_invoice_sequential_dates (v7) should be updated too

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_it_account/AUTHORS.txt'
2--- l10n_it_account/AUTHORS.txt 2013-05-07 12:26:04 +0000
3+++ l10n_it_account/AUTHORS.txt 2013-11-27 23:29:50 +0000
4@@ -1,3 +1,4 @@
5+Sergio Corato <sergio.corato@didotech.com>
6 Davide Corio <davide.corio@domsense.com>
7 Luca Subiaco <subluca@gmail.com>
8 Simone Orsi <simone.orsi@domsense.com>
9
10=== modified file 'l10n_it_account/__openerp__.py'
11--- l10n_it_account/__openerp__.py 2013-09-05 22:04:55 +0000
12+++ l10n_it_account/__openerp__.py 2013-11-27 23:29:50 +0000
13@@ -20,7 +20,7 @@
14 ##############################################################################
15 {
16 'name': 'Italian Localisation - Account',
17- 'version': '0.1',
18+ 'version': '0.2',
19 'category': 'Localisation/Italy',
20 'description': """This module customizes OpenERP in order to fit italian laws and mores - Account version
21
22
23=== modified file 'l10n_it_account/account/invoice.py'
24--- l10n_it_account/account/invoice.py 2013-09-10 11:39:49 +0000
25+++ l10n_it_account/account/invoice.py 2013-11-27 23:29:50 +0000
26@@ -40,22 +40,20 @@
27 date_invoice = obj_inv.date_invoice
28 reg_date = obj_inv.registration_date
29 journal = obj_inv.journal_id.id
30- date_start = obj_inv.registration_date or obj_inv.date_invoice or time.strftime('%Y-%m-%d')
31- date_stop = obj_inv.registration_date or obj_inv.date_invoice or time.strftime('%Y-%m-%d')
32+ fy_id = obj_inv.period_id.fiscalyear_id.id
33 period_ids = self.pool.get('account.period').search(
34- cr, uid, [('date_start','<=',date_start),('date_stop','>=',date_stop),
35- ('company_id', '=', obj_inv.company_id.id)])
36+ cr, uid, [('fiscalyear_id', '=', fy_id), ('company_id', '=', obj_inv.company_id.id)])
37 if inv_type == 'out_invoice' or inv_type == 'out_refund':
38- #check if another invoice with a minor number and a superior date_invoice is posted
39 res = self.search(cr, uid, [('type','=',inv_type),('date_invoice','>',date_invoice),
40- ('number', '<', number), ('journal_id','=',journal),('period_id','in',period_ids)])
41+ ('number', '<', number), ('journal_id', '=', journal),
42+ ('period_id', 'in', period_ids)])
43 if res:
44 raise orm.except_orm(_('Date Inconsistency'),
45 _('Cannot create invoice! Post the invoice with a greater date'))
46 if inv_type == 'in_invoice' or inv_type == 'in_refund':
47- #check if an invoice with a superior registration_date is posted
48 res = self.search(cr, uid, [('type','=',inv_type),('registration_date','>',reg_date),
49- ('journal_id','=',journal),('period_id','in',period_ids)], context=context)
50+ ('number', '<', number), ('journal_id', '=', journal),
51+ ('period_id', 'in', period_ids)], context=context)
52 if res:
53 raise orm.except_orm(_('Date Inconsistency'),
54 _('Cannot create invoice! Post the invoice with a greater date'))
55@@ -63,8 +61,10 @@
56 supplier_invoice_number = obj_inv.supplier_invoice_number
57 partner_id = obj_inv.partner_id.id
58 res = self.search(cr, uid, [('type','=',inv_type),('date_invoice','=',date_invoice),
59- ('journal_id','=',journal),('supplier_invoice_number','=',supplier_invoice_number),
60- ('partner_id','=',partner_id),('state','not in',('draft','cancel'))], context=context)
61+ ('journal_id', '=', journal),
62+ ('supplier_invoice_number', '=', supplier_invoice_number),
63+ ('partner_id', '=', partner_id),
64+ ('state', 'not in', ('draft', 'cancel'))], context=context)
65 if res:
66 raise orm.except_orm(_('Invoice Duplication'),
67 _('Invoice already posted!'))

Subscribers

People subscribed via source and target branches