Merge lp:~openerp-dev/openobject-addons/7.0-opw-596067-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596067-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 37 lines (+14/-6)
1 file modified
l10n_be_invoice_bba/invoice.py (+14/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596067-pna
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+178543@code.launchpad.net

Description of the change

Hello Sir,

I improved 10n_be_invoice_bba change compare algorithm so its compare on invoice type.

For more detail :
https://bugs.launchpad.net/openobject-addons/+bug/1206852

Thanks,
pna

To post a comment you must log in.

Unmerged revisions

9345. By Pinakin Nayi (OpenERP)

[FIX]l10n_be_invoice_bba : change compare algorithm so its compare on invoice type

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_be_invoice_bba/invoice.py'
2--- l10n_be_invoice_bba/invoice.py 2013-06-12 15:26:10 +0000
3+++ l10n_be_invoice_bba/invoice.py 2013-08-05 12:23:26 +0000
4@@ -173,9 +173,13 @@
5 if self.check_bbacomm(reference):
6 reference = re.sub('\D', '', reference)
7 vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++'
8- same_ids = self.search(cr, uid,
9- [('type', '=', 'out_invoice'), ('reference_type', '=', 'bba'),
10- ('reference', '=', vals['reference'])])
11+ if context.get('type') == 'out_invoice' :
12+ domain = [('reference_type', '=', 'bba'),
13+ ('reference', '=', vals['reference']),('type', '=', 'out_invoice')]
14+ else :
15+ domain = [('reference_type', '=', 'bba'),
16+ ('reference', '=', vals['reference']),('type', '=', 'in_invoice'), ('partner_id','=',vals['partner_id'])]
17+ same_ids = self.search(cr, uid, domain)
18 if same_ids:
19 raise osv.except_osv(_('Warning!'),
20 _('The BBA Structured Communication has already been used!' \
21@@ -198,9 +202,13 @@
22 if self.check_bbacomm(bbacomm):
23 reference = re.sub('\D', '', bbacomm)
24 vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++'
25- same_ids = self.search(cr, uid,
26- [('id', '!=', inv.id), ('type', '=', 'out_invoice'),
27- ('reference_type', '=', 'bba'), ('reference', '=', vals['reference'])])
28+ if inv.type == 'out_invoice' :
29+ domain = [('id', '!=', inv.id), ('type', '=', 'out_invoice'),
30+ ('reference_type', '=', 'bba'), ('reference', '=', vals['reference'])]
31+ else :
32+ domain = [('id', '!=', inv.id), ('type', '=', 'in_invoice'),
33+ ('reference_type', '=', 'bba'), ('reference', '=', vals['reference']), ('partner_id', '=', inv.partner_id.id)]
34+ same_ids = self.search(cr, uid, domain)
35 if same_ids:
36 raise osv.except_osv(_('Warning!'),
37 _('The BBA Structured Communication has already been used!' \