Merge lp:~therp-nl/neobis-addons/6.1-auditfile_fixes into lp:neobis-addons/6.1

Proposed by Holger Brunn (Therp) on 2014-01-27
Status: Merged
Approved by: Elias on 2014-01-28
Approved revision: 5
Merged at revision: 5
Proposed branch: lp:~therp-nl/neobis-addons/6.1-auditfile_fixes
Merge into: lp:neobis-addons/6.1
Diff against target: 111 lines (+22/-18)
2 files modified
nbs_xml_auditfile_financieel/auditfile_export.py (+14/-11)
nbs_xml_auditfile_financieel/data/auditfile_template.xml (+8/-7)
To merge this branch: bzr merge lp:~therp-nl/neobis-addons/6.1-auditfile_fixes
Reviewer Review Type Date Requested Status
Elias visual 2014-01-27 Approve on 2014-01-28
Review via email: mp+203371@code.launchpad.net

Description of the change

Thanks for the auditfile module!

This MP mainly contains fixes for coping with malformatted in the database and changes the way parters are selected, as the original way of doing it goes wrong for very big databases with a lot of partners.

To post a comment you must log in.
Elias (rtxehi) wrote :

Holger,

Thanks for the updates, they look good to me, so I'll merge the changes soon.

Thanks again!

review: Approve (visual)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nbs_xml_auditfile_financieel/auditfile_export.py'
--- nbs_xml_auditfile_financieel/auditfile_export.py 2013-03-25 13:47:29 +0000
+++ nbs_xml_auditfile_financieel/auditfile_export.py 2014-01-27 16:46:34 +0000
@@ -26,6 +26,7 @@
26from tools.translate import _26from tools.translate import _
27from lxml import etree27from lxml import etree
28import sys28import sys
29import traceback
29import release30import release
30import datetime31import datetime
31import logging32import logging
@@ -89,11 +90,20 @@
8990
90 data = self.browse(cr, uid, ids[0], context=id)91 data = self.browse(cr, uid, ids[0], context=id)
9192
93 # periods search
94 period_obj = self.pool.get("account.period")
95 period_ids = period_obj.search(cr, uid, ['&',
96 ('id', '>=', data.period_start.id),
97 ('id', '<=', data.period_stop.id)])
98 periods = period_obj.browse(cr, uid, period_ids)
99
92 # partners search100 # partners search
101 cr.execute(
102 'select distinct partner_id from account_move_line where '
103 'period_id in %s and partner_id is not NULL',
104 (tuple(period_ids),))
105 partners_obj_ids = [x[0] or 0 for x in cr.fetchall()]
93 partners_obj = self.pool.get("res.partner")106 partners_obj = self.pool.get("res.partner")
94 partners_obj_ids = partners_obj.search(cr, uid, ['|',
95 ('supplier', '=', 'True'),
96 ('customer', '=', 'True')])
97 partners = partners_obj.browse(cr, uid, partners_obj_ids)107 partners = partners_obj.browse(cr, uid, partners_obj_ids)
98108
99 if not partners:109 if not partners:
@@ -116,13 +126,6 @@
116 return True126 return True
117 _validate_country_ids(partners)127 _validate_country_ids(partners)
118128
119 # periods search
120 period_obj = self.pool.get("account.period")
121 period_ids = period_obj.search(cr, uid, ['&',
122 ('id', '>=', data.period_start.id),
123 ('id', '<=', data.period_stop.id)])
124 periods = period_obj.browse(cr, uid, period_ids)
125
126 # journal search129 # journal search
127 journal_obj = self.pool.get("account.journal")130 journal_obj = self.pool.get("account.journal")
128 journal_ids = journal_obj.search(cr, uid, [])131 journal_ids = journal_obj.search(cr, uid, [])
@@ -253,7 +256,7 @@
253 )256 )
254 self._logger.info('auditfile_export created succesfully')257 self._logger.info('auditfile_export created succesfully')
255 except:258 except:
256 self._logger.error(sys.exc_info())259 self._logger.error(traceback.format_exception(*sys.exc_info()))
257 raise osv.except_osv(_('Data Error'),260 raise osv.except_osv(_('Data Error'),
258 _('Invalid Data. Please, see logs for details.'))261 _('Invalid Data. Please, see logs for details.'))
259262
260263
=== modified file 'nbs_xml_auditfile_financieel/data/auditfile_template.xml'
--- nbs_xml_auditfile_financieel/data/auditfile_template.xml 2013-03-25 13:47:29 +0000
+++ nbs_xml_auditfile_financieel/data/auditfile_template.xml 2014-01-27 16:46:34 +0000
@@ -16,40 +16,41 @@
16 <p:streetAddress>16 <p:streetAddress>
17 <p:streetname text-eval="text(company.street)"></p:streetname>17 <p:streetname text-eval="text(company.street)"></p:streetname>
18 <p:city text-eval="text(company.city)"></p:city>18 <p:city text-eval="text(company.city)"></p:city>
19 <p:postalCode text-eval="text(company.zip)"></p:postalCode>19 <p:postalCode text-eval="text(company.zip)[:10]"></p:postalCode>
20 <p:region text-eval="text(company.state_id.name)"></p:region>20 <p:region text-eval="text(company.state_id.name)"></p:region>
21 <p:country text-eval="company.country_id.code"></p:country>21 <p:country text-eval="company.country_id.code"></p:country>
22 </p:streetAddress>22 </p:streetAddress>
23 <p:postalAddress>23 <p:postalAddress>
24 <p:streetname text-eval="text(company.street)"></p:streetname>24 <p:streetname text-eval="text(company.street)"></p:streetname>
25 <p:city text-eval="text(company.city)"></p:city>25 <p:city text-eval="text(company.city)"></p:city>
26 <p:postalCode text-eval="text(company.zip)"></p:postalCode>26 <p:postalCode text-eval="text(company.zip)[:10]"></p:postalCode>
27 <p:region text-eval="text(company.state_id.name)"></p:region>27 <p:region text-eval="text(company.state_id.name)"></p:region>
28 <p:country text-eval="company.country_id.code"></p:country>28 <p:country text-eval="company.country_id.code"></p:country>
29 </p:postalAddress>29 </p:postalAddress>
30 <p:customersSuppliers>30 <p:customersSuppliers>
31 <p:customerSupplier><p:custSupID text-eval="'False'"></p:custSupID></p:customerSupplier>
31 <p:customerSupplier seq-eval="partners" var="partner">32 <p:customerSupplier seq-eval="partners" var="partner">
32 <p:custSupID text-eval="partner.id"></p:custSupID>33 <p:custSupID text-eval="partner.id"></p:custSupID>
33 <p:custSupName text-eval="partner.name"></p:custSupName>34 <p:custSupName text-eval="partner.name[:50]"></p:custSupName>
34 <p:contact text-eval="partner.name"></p:contact>35 <p:contact text-eval="partner.name[:50]"></p:contact>
35 <p:telephone text-eval="text(partner.phone)"></p:telephone>36 <p:telephone text-eval="text(partner.phone)"></p:telephone>
36 <p:fax text-eval="text(partner.phone)"></p:fax>37 <p:fax text-eval="text(partner.phone)"></p:fax>
37 <p:eMail text-eval="text(partner.email)"></p:eMail>38 <p:eMail text-eval="text(partner.email)"></p:eMail>
38 <p:website text-eval="text(partner.website)"></p:website>39 <p:website text-eval="text(partner.website)"></p:website>
39 <p:taxRegistrationCountry text-eval="partner.address[0].country_id.code"></p:taxRegistrationCountry>40 <p:taxRegistrationCountry text-eval="partner.address and partner.address[0].country_id.code"></p:taxRegistrationCountry>
40 <p:taxRegIdent text-eval="text(partner.vat)"></p:taxRegIdent>41 <p:taxRegIdent text-eval="text(partner.vat)"></p:taxRegIdent>
41 <p:custSupTp text-eval="custSupTp(partner.supplier,partner.customer)"></p:custSupTp>42 <p:custSupTp text-eval="custSupTp(partner.supplier,partner.customer)"></p:custSupTp>
42 <p:streetAddress seq-eval="partner.address" var="address">43 <p:streetAddress seq-eval="partner.address" var="address">
43 <p:streetname text-eval="text(address.street)"></p:streetname>44 <p:streetname text-eval="text(address.street)"></p:streetname>
44 <p:city text-eval="text(address.city)"></p:city>45 <p:city text-eval="text(address.city)"></p:city>
45 <p:postalCode text-eval="text(address.zip)"></p:postalCode>46 <p:postalCode text-eval="text(address.zip)[:10]"></p:postalCode>
46 <p:region text-eval="text(address.state_id.name)"></p:region>47 <p:region text-eval="text(address.state_id.name)"></p:region>
47 <p:country text-eval="address.country_id.code"></p:country>48 <p:country text-eval="address.country_id.code"></p:country>
48 </p:streetAddress>49 </p:streetAddress>
49 <p:postalAddress seq-eval="partner.address" var="address">50 <p:postalAddress seq-eval="partner.address" var="address">
50 <p:streetname text-eval="text(address.street)"></p:streetname>51 <p:streetname text-eval="text(address.street)"></p:streetname>
51 <p:city text-eval="text(address.city)"></p:city>52 <p:city text-eval="text(address.city)"></p:city>
52 <p:postalCode text-eval="text(address.zip)"></p:postalCode>53 <p:postalCode text-eval="text(address.zip)[:10]"></p:postalCode>
53 <p:region text-eval="text(address.state_id.name)"></p:region>54 <p:region text-eval="text(address.state_id.name)"></p:region>
54 <p:country text-eval="address.country_id.code"></p:country>55 <p:country text-eval="address.country_id.code"></p:country>
55 </p:postalAddress>56 </p:postalAddress>

Subscribers

People subscribed via source and target branches