Merge lp:~savoirfairelinux-openerp/openerp-sage-50/7.0-exportsage50 into lp:openerp-sage-50
- 7.0-exportsage50
- Merge into 7.0
Status: | Rejected |
---|---|
Rejected by: | Sandy Carter (http://www.savoirfairelinux.com) |
Proposed branch: | lp:~savoirfairelinux-openerp/openerp-sage-50/7.0-exportsage50 |
Merge into: | lp:openerp-sage-50 |
Diff against target: |
596 lines (+545/-0) 7 files modified
exportsage50/__init__.py (+24/-0) exportsage50/__openerp__.py (+121/-0) exportsage50/i18n/exportsage50.pot (+140/-0) exportsage50/security/ir.model.access.csv (+2/-0) exportsage50/wizard/__init__.py (+22/-0) exportsage50/wizard/exportsage50.py (+189/-0) exportsage50/wizard/exportsage50_view.xml (+47/-0) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/openerp-sage-50/7.0-exportsage50 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sandy Carter (http://www.savoirfairelinux.com) | Needs Resubmitting | ||
Maxime Chambreuil (http://www.savoirfairelinux.com) | code review | Approve | |
Joao Alfredo Gama Batista | Needs Fixing | ||
OpenERP Community Reviewer/Maintainer | Pending | ||
Review via email: mp+191893@code.launchpad.net |
Commit message
Description of the change
[UPG] Upgrade to version 7.0
- 5. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP] Move files into module directory
Joao Alfredo Gama Batista (joao-gama) wrote : | # |
El Hadji Dem (http://www.savoirfairelinux.com) (eh-dem) wrote : | # |
> Hi eh.dem,
>
> l.157.158.161 - On the 7.0 it's better to use the keywords data and demo
> instead of init_xml, update_xml and demo_xml.
>
> l.366.377 - osv.osv is deprecated. Use "from openerp.osv import fields, orm"
> and "class exportsage(
Thanks Joao
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) : | # |
- 9. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Move contributors in description file and remove french doc
- 10. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Fix PEP8 issues
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : | # |
I would rename the module to export_sage50 or accounting_
Code issues:
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
Minor code / Style issues:
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
exportsage50/
- 11. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP] Improve code : comments from launchpad
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : | # |
This PR has been moved to https:/
Please continue further development there.
Unmerged revisions
- 11. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP] Improve code : comments from launchpad
- 10. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Fix PEP8 issues
- 9. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Move contributors in description file and remove french doc
- 8. By EL HADJI DEM <email address hidden>
-
[IMP] add author file
- 7. By EL HADJI DEM <email address hidden>
-
[IMP] add pot file, indent code, write the original author
- 6. By EL HADJI DEM <email address hidden>
-
code review
- 5. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP] Move files into module directory
- 4. By El Hadji Dem (http://www.savoirfairelinux.com)
-
Migration du code pour OE7 et code review
- 3. By El Hadji Dem (http://www.savoirfairelinux.com)
-
supprimer le dossier images
- 2. By El Hadji Dem (http://www.savoirfairelinux.com)
-
Migration du code vers OE7 et code review
Preview Diff
1 | === added directory 'exportsage50' | |||
2 | === added file 'exportsage50/__init__.py' | |||
3 | --- exportsage50/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ exportsage50/__init__.py 2014-01-17 23:22:31 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- encoding: utf-8 -*- | ||
7 | 2 | ############################################################################### | ||
8 | 3 | # | ||
9 | 4 | # OpenERP, Open Source Management Solution | ||
10 | 5 | # Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.com>). | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU Affero General Public License as | ||
14 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
15 | 10 | # License, or (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU Affero General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################### | ||
26 | 21 | |||
27 | 22 | from . import wizard | ||
28 | 23 | |||
29 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
30 | 0 | 25 | ||
31 | === added file 'exportsage50/__init__.pyc' | |||
32 | 1 | Binary files exportsage50/__init__.pyc 1970-01-01 00:00:00 +0000 and exportsage50/__init__.pyc 2014-01-17 23:22:31 +0000 differ | 26 | Binary files exportsage50/__init__.pyc 1970-01-01 00:00:00 +0000 and exportsage50/__init__.pyc 2014-01-17 23:22:31 +0000 differ |
33 | === added file 'exportsage50/__openerp__.py' | |||
34 | --- exportsage50/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
35 | +++ exportsage50/__openerp__.py 2014-01-17 23:22:31 +0000 | |||
36 | @@ -0,0 +1,121 @@ | |||
37 | 1 | # -*- encoding: utf-8 -*- | ||
38 | 2 | ############################################################################### | ||
39 | 3 | # | ||
40 | 4 | # OpenERP, Open Source Management Solution | ||
41 | 5 | # Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.com>). | ||
42 | 6 | # | ||
43 | 7 | # This program is free software: you can redistribute it and/or modify | ||
44 | 8 | # it under the terms of the GNU Affero General Public License as | ||
45 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
46 | 10 | # License, or (at your option) any later version. | ||
47 | 11 | # | ||
48 | 12 | # This program is distributed in the hope that it will be useful, | ||
49 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
50 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
51 | 15 | # GNU Affero General Public License for more details. | ||
52 | 16 | # | ||
53 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
54 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
55 | 19 | # | ||
56 | 20 | ############################################################################### | ||
57 | 21 | |||
58 | 22 | { | ||
59 | 23 | 'name': 'Export to Sage50', | ||
60 | 24 | 'version': '1.0', | ||
61 | 25 | "category": 'Accounting & Finance', | ||
62 | 26 | 'complexity': "easy", | ||
63 | 27 | 'description': """ | ||
64 | 28 | |||
65 | 29 | Export accounting data from OpenERP to Sage50 | ||
66 | 30 | ============================================= | ||
67 | 31 | |||
68 | 32 | Export accounting data from OpenERP to Sage50. The export generates the imp file to import in Sage50. | ||
69 | 33 | |||
70 | 34 | |||
71 | 35 | Documentation : layout of the import file (.IMP) | ||
72 | 36 | ------------------------------------------------ | ||
73 | 37 | |||
74 | 38 | A PDF document (in the /doc repository) gives more details about the .IMP file layout that can be imported | ||
75 | 39 | into Sage 50. This document is part of the Sage 50 SDK (Software Development Kit) available for download at | ||
76 | 40 | the following address : http://na.sage.com/sage-simply-accounting/lp/partners/sdk/?isnow=ssa. | ||
77 | 41 | |||
78 | 42 | Sage 50: After creating .IMP file | ||
79 | 43 | --------------------------------- | ||
80 | 44 | |||
81 | 45 | Solution: | ||
82 | 46 | * Importing purchase invoices, purchase quotes, sales invoices and sales orders into Sage 50 | ||
83 | 47 | |||
84 | 48 | How to import purchase invoices, purchase quotes, sales invoices and sales orders? | ||
85 | 49 | |||
86 | 50 | You can import purchase invoices, purchase quotes, sales invoices and sales orders into Sage 50. | ||
87 | 51 | The transaction(s) details should be in a text file with extension .IMP. | ||
88 | 52 | |||
89 | 53 | After you have created the .IMP file, you can import the transaction(s) into Sage 50 by following these steps: | ||
90 | 54 | (Account information is not included in the .IMP format because when importing the file, you will receive | ||
91 | 55 | a pop-up screen to ask you "Select an Account to match".) | ||
92 | 56 | |||
93 | 57 | * From the Home Window, go to File, Import/Export | ||
94 | 58 | * Click on Import Transactions (the Import Transactions Wizard appears) | ||
95 | 59 | * Select on 'Import purchase invoices, purchase quotes, sales invoices, sales orders or time slips' and click Next | ||
96 | 60 | * You can now create a backup of your file | ||
97 | 61 | * Click Next | ||
98 | 62 | * Click on Browse and select the .IMP file previously created | ||
99 | 63 | * If the customer (or vendor) in the transaction(s) you are trying to import does not exist in the Sage 50 company, | ||
100 | 64 | you will get a new window asking you if you want to add this customer (or vendor), or if you want to select | ||
101 | 65 | another customer (or vendor) from the existing ones | ||
102 | 66 | * You will also get a similar window if the import file uses an inventory item which does not exist in Sage 50. | ||
103 | 67 | * You will see a summary of the imported transactions, click OK and then Finish. | ||
104 | 68 | * If you got any errors importing the data, open the .IMP file in Notepad and use the attached .PDF document | ||
105 | 69 | to verify the file format. Once the errors have been corrected, you can try the import again. | ||
106 | 70 | |||
107 | 71 | Note: View KB25664 for information about some possible errors when importing .IMP file. | ||
108 | 72 | |||
109 | 73 | Sage Business Care plan does NOT include support for SDK. Please, contact one of our partners website | ||
110 | 74 | for further assistance. | ||
111 | 75 | |||
112 | 76 | Possible errors when importing purchase invoices, purchase quotes, sales invoices and/or sales orders | ||
113 | 77 | ===================================================================================================== | ||
114 | 78 | |||
115 | 79 | Questions and Answers | ||
116 | 80 | |||
117 | 81 | Import started... Errors occurred while importing. | ||
118 | 82 | Line x does not contain compatible tax information. | ||
119 | 83 | Invalid date. The date must be between <date1> and <date2>. | ||
120 | 84 | |||
121 | 85 | |||
122 | 86 | A: These are the possible reasons for getting any of these error messages when importing transactions | ||
123 | 87 | into Simply Accounting: | ||
124 | 88 | |||
125 | 89 | * The import file (extension .IMP) you are using does not have the proper format. | ||
126 | 90 | Refer to the KB article 25659 for more information about the format of the import file. | ||
127 | 91 | |||
128 | 92 | * The transaction type is not enabled in the Simply Accounting company. To enable the feature, from the Home Window | ||
129 | 93 | in Simply Accounting, go to Setup, Settings, Company, Features, make sure the type of transaction you want to import | ||
130 | 94 | is checked | ||
131 | 95 | |||
132 | 96 | * The dates in the import file do not match the fiscal year dates in Simply Accounting. | ||
133 | 97 | Open the import file in Notepad and make the necessary changes | ||
134 | 98 | |||
135 | 99 | Contributors | ||
136 | 100 | ------------ | ||
137 | 101 | |||
138 | 102 | * El Hadji Dem <elhadji.dem@savoirfairelinux.com> | ||
139 | 103 | * Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com> | ||
140 | 104 | |||
141 | 105 | """, | ||
142 | 106 | 'author': 'Gestion-Ressources', | ||
143 | 107 | 'website': 'http://www.gestion-ressources.com', | ||
144 | 108 | "license": "AGPL-3", | ||
145 | 109 | 'images': [], | ||
146 | 110 | 'depends': ['account'], | ||
147 | 111 | 'data': [ | ||
148 | 112 | 'security/ir.model.access.csv', | ||
149 | 113 | 'wizard/exportsage50_view.xml' | ||
150 | 114 | ], | ||
151 | 115 | 'demo': [], | ||
152 | 116 | 'test': [], | ||
153 | 117 | 'installable': True, | ||
154 | 118 | 'auto_install': False, | ||
155 | 119 | 'application': True, | ||
156 | 120 | } | ||
157 | 121 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
158 | 0 | 122 | ||
159 | === added directory 'exportsage50/docs' | |||
160 | === added file 'exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf' | |||
161 | 1 | Binary files exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 2014-01-17 23:22:31 +0000 differ | 123 | Binary files exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 2014-01-17 23:22:31 +0000 differ |
162 | === added file 'exportsage50/docs/dev-import.pdf' | |||
163 | 2 | Binary files exportsage50/docs/dev-import.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/dev-import.pdf 2014-01-17 23:22:31 +0000 differ | 124 | Binary files exportsage50/docs/dev-import.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/dev-import.pdf 2014-01-17 23:22:31 +0000 differ |
164 | === added directory 'exportsage50/i18n' | |||
165 | === added file 'exportsage50/i18n/exportsage50.pot' | |||
166 | --- exportsage50/i18n/exportsage50.pot 1970-01-01 00:00:00 +0000 | |||
167 | +++ exportsage50/i18n/exportsage50.pot 2014-01-17 23:22:31 +0000 | |||
168 | @@ -0,0 +1,140 @@ | |||
169 | 1 | # Translation of OpenERP Server. | ||
170 | 2 | # This file contains the translation of the following modules: | ||
171 | 3 | # * exportsage50 | ||
172 | 4 | # | ||
173 | 5 | msgid "" | ||
174 | 6 | msgstr "" | ||
175 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
176 | 8 | "Report-Msgid-Bugs-To: \n" | ||
177 | 9 | "POT-Creation-Date: 2013-11-15 16:22+0000\n" | ||
178 | 10 | "PO-Revision-Date: 2013-11-15 16:22+0000\n" | ||
179 | 11 | "Last-Translator: <>\n" | ||
180 | 12 | "Language-Team: \n" | ||
181 | 13 | "MIME-Version: 1.0\n" | ||
182 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
183 | 15 | "Content-Transfer-Encoding: \n" | ||
184 | 16 | "Plural-Forms: \n" | ||
185 | 17 | |||
186 | 18 | #. module: exportsage50 | ||
187 | 19 | #: field:exportsage,name:0 | ||
188 | 20 | msgid "Filename" | ||
189 | 21 | msgstr "" | ||
190 | 22 | |||
191 | 23 | #. module: exportsage50 | ||
192 | 24 | #: field:exportsage,format:0 | ||
193 | 25 | msgid "File Format" | ||
194 | 26 | msgstr "" | ||
195 | 27 | |||
196 | 28 | #. module: exportsage50 | ||
197 | 29 | #: field:exportsage,state:0 | ||
198 | 30 | msgid "unknown" | ||
199 | 31 | msgstr "" | ||
200 | 32 | |||
201 | 33 | #. module: exportsage50 | ||
202 | 34 | #: view:exportsage:0 | ||
203 | 35 | msgid "Here is the exported file:" | ||
204 | 36 | msgstr "" | ||
205 | 37 | |||
206 | 38 | #. module: exportsage50 | ||
207 | 39 | #: model:ir.model,name:exportsage50.model_exportsage | ||
208 | 40 | msgid "Create imp file to export in sage50" | ||
209 | 41 | msgstr "" | ||
210 | 42 | |||
211 | 43 | #. module: exportsage50 | ||
212 | 44 | #: selection:exportsage,state:0 | ||
213 | 45 | msgid "choose" | ||
214 | 46 | msgstr "" | ||
215 | 47 | |||
216 | 48 | #. module: exportsage50 | ||
217 | 49 | #: view:exportsage:0 | ||
218 | 50 | msgid "Unicode/UTF-8" | ||
219 | 51 | msgstr "" | ||
220 | 52 | |||
221 | 53 | #. module: exportsage50 | ||
222 | 54 | #: view:exportsage:0 | ||
223 | 55 | msgid "file encoding, please be sure to view and edit using the same encoding." | ||
224 | 56 | msgstr "" | ||
225 | 57 | |||
226 | 58 | #. module: exportsage50 | ||
227 | 59 | #: selection:exportsage,state:0 | ||
228 | 60 | msgid "get" | ||
229 | 61 | msgstr "" | ||
230 | 62 | |||
231 | 63 | #. module: exportsage50 | ||
232 | 64 | #: view:exportsage:0 | ||
233 | 65 | msgid "This file was generated using the universal" | ||
234 | 66 | msgstr "" | ||
235 | 67 | |||
236 | 68 | #. module: exportsage50 | ||
237 | 69 | #: view:exportsage:0 | ||
238 | 70 | msgid "Cancel" | ||
239 | 71 | msgstr "" | ||
240 | 72 | |||
241 | 73 | #. module: exportsage50 | ||
242 | 74 | #: code:addons/exportsage50/wizard/exportsage50.py:68 | ||
243 | 75 | #, python-format | ||
244 | 76 | msgid "Error" | ||
245 | 77 | msgstr "" | ||
246 | 78 | |||
247 | 79 | #. module: exportsage50 | ||
248 | 80 | #: view:exportsage:0 | ||
249 | 81 | msgid "Export Complete" | ||
250 | 82 | msgstr "" | ||
251 | 83 | |||
252 | 84 | #. module: exportsage50 | ||
253 | 85 | #: view:exportsage:0 | ||
254 | 86 | msgid "Export Settings" | ||
255 | 87 | msgstr "" | ||
256 | 88 | |||
257 | 89 | #. module: exportsage50 | ||
258 | 90 | #: help:exportsage,invoice_ids:0 | ||
259 | 91 | msgid "This is the list of invoices that have been generated for this sales order. The same sales order may have been invoiced in several times (by line for example)." | ||
260 | 92 | msgstr "" | ||
261 | 93 | |||
262 | 94 | #. module: exportsage50 | ||
263 | 95 | #: model:ir.actions.act_window,name:exportsage50.action_account_invoice_generate_export_view | ||
264 | 96 | #: model:ir.ui.menu,name:exportsage50.menu_account_invoice_generate_export_view | ||
265 | 97 | msgid "Export accounting data to Sage50" | ||
266 | 98 | msgstr "" | ||
267 | 99 | |||
268 | 100 | #. module: exportsage50 | ||
269 | 101 | #: field:exportsage,invoice_ids:0 | ||
270 | 102 | msgid "Invoices" | ||
271 | 103 | msgstr "" | ||
272 | 104 | |||
273 | 105 | #. module: exportsage50 | ||
274 | 106 | #: view:exportsage:0 | ||
275 | 107 | msgid "or" | ||
276 | 108 | msgstr "" | ||
277 | 109 | |||
278 | 110 | #. module: exportsage50 | ||
279 | 111 | #: code:addons/exportsage50/wizard/exportsage50.py:68 | ||
280 | 112 | #, python-format | ||
281 | 113 | msgid "You have to select at least 1 Invoice. And try again" | ||
282 | 114 | msgstr "" | ||
283 | 115 | |||
284 | 116 | #. module: exportsage50 | ||
285 | 117 | #: view:exportsage:0 | ||
286 | 118 | msgid "This action allows you to export accounting data from OpenErp to Simply account.You should have the same configuration about the tax information" | ||
287 | 119 | msgstr "" | ||
288 | 120 | |||
289 | 121 | #. module: exportsage50 | ||
290 | 122 | #: field:exportsage,data:0 | ||
291 | 123 | msgid "File" | ||
292 | 124 | msgstr "" | ||
293 | 125 | |||
294 | 126 | #. module: exportsage50 | ||
295 | 127 | #: view:exportsage:0 | ||
296 | 128 | msgid "Export to Sage50" | ||
297 | 129 | msgstr "" | ||
298 | 130 | |||
299 | 131 | #. module: exportsage50 | ||
300 | 132 | #: view:exportsage:0 | ||
301 | 133 | msgid "Close" | ||
302 | 134 | msgstr "" | ||
303 | 135 | |||
304 | 136 | #. module: exportsage50 | ||
305 | 137 | #: view:exportsage:0 | ||
306 | 138 | msgid "Export" | ||
307 | 139 | msgstr "" | ||
308 | 140 | |||
309 | 0 | 141 | ||
310 | === added directory 'exportsage50/security' | |||
311 | === added file 'exportsage50/security/ir.model.access.csv' | |||
312 | --- exportsage50/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
313 | +++ exportsage50/security/ir.model.access.csv 2014-01-17 23:22:31 +0000 | |||
314 | @@ -0,0 +1,2 @@ | |||
315 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
316 | 2 | access_exportsage,exportsage,model_exportsage,account.group_account_user,1,0,0,0 | ||
317 | 0 | 3 | ||
318 | === added directory 'exportsage50/static' | |||
319 | === added directory 'exportsage50/static/src' | |||
320 | === added directory 'exportsage50/static/src/img' | |||
321 | === added file 'exportsage50/static/src/img/icon.png' | |||
322 | 1 | Binary files exportsage50/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and exportsage50/static/src/img/icon.png 2014-01-17 23:22:31 +0000 differ | 4 | Binary files exportsage50/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and exportsage50/static/src/img/icon.png 2014-01-17 23:22:31 +0000 differ |
323 | === added directory 'exportsage50/wizard' | |||
324 | === added file 'exportsage50/wizard/__init__.py' | |||
325 | --- exportsage50/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
326 | +++ exportsage50/wizard/__init__.py 2014-01-17 23:22:31 +0000 | |||
327 | @@ -0,0 +1,22 @@ | |||
328 | 1 | # -*- encoding: utf-8 -*- | ||
329 | 2 | ############################################################################### | ||
330 | 3 | # | ||
331 | 4 | # OpenERP, Open Source Management Solution | ||
332 | 5 | # Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.com>). | ||
333 | 6 | # | ||
334 | 7 | # This program is free software: you can redistribute it and/or modify | ||
335 | 8 | # it under the terms of the GNU Affero General Public License as | ||
336 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
337 | 10 | # License, or (at your option) any later version. | ||
338 | 11 | # | ||
339 | 12 | # This program is distributed in the hope that it will be useful, | ||
340 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
341 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
342 | 15 | # GNU Affero General Public License for more details. | ||
343 | 16 | # | ||
344 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
345 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
346 | 19 | # | ||
347 | 20 | ############################################################################### | ||
348 | 21 | from . import exportsage50 | ||
349 | 22 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
350 | 0 | 23 | ||
351 | === added file 'exportsage50/wizard/exportsage50.py' | |||
352 | --- exportsage50/wizard/exportsage50.py 1970-01-01 00:00:00 +0000 | |||
353 | +++ exportsage50/wizard/exportsage50.py 2014-01-17 23:22:31 +0000 | |||
354 | @@ -0,0 +1,189 @@ | |||
355 | 1 | # -*- encoding: utf-8 -*- | ||
356 | 2 | ############################################################################### | ||
357 | 3 | # | ||
358 | 4 | # OpenERP, Open Source Management Solution | ||
359 | 5 | # Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.com>). | ||
360 | 6 | # | ||
361 | 7 | # This program is free software: you can redistribute it and/or modify | ||
362 | 8 | # it under the terms of the GNU Affero General Public License as | ||
363 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
364 | 10 | # License, or (at your option) any later version. | ||
365 | 11 | # | ||
366 | 12 | # This program is distributed in the hope that it will be useful, | ||
367 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
368 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
369 | 15 | # GNU Affero General Public License for more details. | ||
370 | 16 | # | ||
371 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
372 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
373 | 19 | # | ||
374 | 20 | ############################################################################### | ||
375 | 21 | |||
376 | 22 | from openerp.osv import fields, orm | ||
377 | 23 | import base64 | ||
378 | 24 | from openerp.tools.translate import _ | ||
379 | 25 | import pooler | ||
380 | 26 | from datetime import datetime | ||
381 | 27 | import unicodedata | ||
382 | 28 | |||
383 | 29 | |||
384 | 30 | class exportsage(orm.Model): | ||
385 | 31 | _name = "exportsage" | ||
386 | 32 | _description = "Create imp file to export in sage50" | ||
387 | 33 | _columns = { | ||
388 | 34 | 'data': fields.binary('File', readonly=True), | ||
389 | 35 | 'name': fields.char('Filename', 20, readonly=True), | ||
390 | 36 | 'format': fields.char('File Format', 10), | ||
391 | 37 | 'state': fields.selection([('choose', 'choose'), | ||
392 | 38 | ('get', 'get')]), | ||
393 | 39 | 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_export_rel', 'order_id', 'invoice_id', | ||
394 | 40 | 'Invoices', required=True, | ||
395 | 41 | help="This is the list of invoices that have been generated " | ||
396 | 42 | "for this sales order. The same sales order may have been invoiced " | ||
397 | 43 | "in several times (by line for example)."), | ||
398 | 44 | } | ||
399 | 45 | |||
400 | 46 | _defaults = { | ||
401 | 47 | 'state': lambda *a: 'choose', | ||
402 | 48 | } | ||
403 | 49 | |||
404 | 50 | def act_cancel(self, cr, uid, ids, context=None): | ||
405 | 51 | return {'type': 'ir.actions.act_window_close'} | ||
406 | 52 | |||
407 | 53 | def act_destroy(self, *args): | ||
408 | 54 | return {'type': 'ir.actions.act_window_close'} | ||
409 | 55 | |||
410 | 56 | def create_report(self, cr, uid, ids, context=None): | ||
411 | 57 | if context is None: | ||
412 | 58 | context = {} | ||
413 | 59 | this = self.browse(cr, uid, ids, context=context)[0] | ||
414 | 60 | data = self.read(cr, uid, ids, [], context=context)[0] | ||
415 | 61 | |||
416 | 62 | if not data['invoice_ids']: | ||
417 | 63 | raise orm.except_orm(_('Error'), _('You have to select at least 1 Invoice. And try again')) | ||
418 | 64 | |||
419 | 65 | output = '<Version>''\n' + '"12001"' + ',' + '"1"''\n' + '</Version>\n\n' | ||
420 | 66 | # Do the treatment of other lines in the invoice lines | ||
421 | 67 | pool = pooler.get_pool(cr.dbname) | ||
422 | 68 | line_obj = pool.get('account.invoice') | ||
423 | 69 | account_move_line_obj = self.pool.get('account.move.line') | ||
424 | 70 | account_invoice_line_obj = self.pool.get('account.invoice.line') | ||
425 | 71 | decimal_precision_obj = self.pool.get('decimal.precision') | ||
426 | 72 | |||
427 | 73 | for line in line_obj.browse(cr, uid, data['invoice_ids'], context=context): | ||
428 | 74 | # start tag for invoice lines | ||
429 | 75 | output += '<SalInvoice>''\n' | ||
430 | 76 | #informations sur le client | ||
431 | 77 | costumer_name = line.partner_id.name | ||
432 | 78 | onetimefield = "" | ||
433 | 79 | contact_name = line.partner_id.name or "" | ||
434 | 80 | street1 = line.partner_id.street or "" | ||
435 | 81 | street2 = line.partner_id.street2 or "" | ||
436 | 82 | city = line.partner_id.city or "" | ||
437 | 83 | province_state = line.partner_id.state_id.name or "" | ||
438 | 84 | zip_code = line.partner_id.zip or "" | ||
439 | 85 | country = line.partner_id.country_id.name or "" | ||
440 | 86 | phone1 = line.partner_id.phone or "" | ||
441 | 87 | mobile = line.partner_id.mobile or "" | ||
442 | 88 | fax = line.partner_id.fax or "" | ||
443 | 89 | email = line.partner_id.email or "" | ||
444 | 90 | # Customer line | ||
445 | 91 | fields = [costumer_name, onetimefield, contact_name, street1, street2, | ||
446 | 92 | city, province_state, zip_code, country, phone1, mobile, fax, email | ||
447 | 93 | ] | ||
448 | 94 | costumer = ','.join(['"%s"' % field for field in fields]) | ||
449 | 95 | output += costumer.encode('UTF-8') + '\n' | ||
450 | 96 | # Invoice informations | ||
451 | 97 | no_of_details = str(len(line.invoice_line)) | ||
452 | 98 | order_no = "" | ||
453 | 99 | # Invoice number (Max 20 chars) | ||
454 | 100 | invoice_no = str(line.number) | ||
455 | 101 | # Get invoice date | ||
456 | 102 | entry_date = datetime.strptime(line.date_invoice, "%Y-%m-%d").strftime('%m-%d-%Y')\ | ||
457 | 103 | if line.date_invoice else "" | ||
458 | 104 | # Type of payment (between 0 and 3) | ||
459 | 105 | # 0 = pay later , 1 = cash , 2 = cheque , 3 = credit card | ||
460 | 106 | # Select last payment | ||
461 | 107 | list_id = [] | ||
462 | 108 | # Paid by source (20 Chars) : Blank- pay later and cash Cheque number or credit card | ||
463 | 109 | paid_by_source = "" | ||
464 | 110 | if line.payment_ids: | ||
465 | 111 | lastId = max(line.payment_ids).id | ||
466 | 112 | for oneId in line.payment_ids: | ||
467 | 113 | list_id.append(oneId.id) | ||
468 | 114 | lastId = max(list_id) | ||
469 | 115 | # access from the last payment account_move_line object | ||
470 | 116 | account_move_line = account_move_line_obj.browse(cr, uid, lastId, context=context) | ||
471 | 117 | paiement_type = account_move_line.journal_id.type | ||
472 | 118 | if paiement_type == 'cash': | ||
473 | 119 | paid_by_type = str(1) | ||
474 | 120 | paid_by_source = account_move_line.ref | ||
475 | 121 | elif paiement_type == 'bank': | ||
476 | 122 | paid_by_type = str(2) | ||
477 | 123 | else: | ||
478 | 124 | paid_by_type = str(0) # default value 0 = pay later | ||
479 | 125 | else: | ||
480 | 126 | paid_by_type = str(0) # default value 0 = pay later | ||
481 | 127 | total_amount = str(line.amount_total) or "" | ||
482 | 128 | freight_amount = "0.0" | ||
483 | 129 | fields_sale_invoice = [no_of_details, order_no, invoice_no, entry_date, paid_by_type, | ||
484 | 130 | paid_by_source, total_amount, freight_amount] | ||
485 | 131 | sale_invoice = ','.join(['"%s"' % one_field for one_field in fields_sale_invoice]) | ||
486 | 132 | output += sale_invoice.encode('UTF-8') + '\n' | ||
487 | 133 | product_line_invoice_with_tax = "" | ||
488 | 134 | #Sale invoice detail lines | ||
489 | 135 | product_ids = account_invoice_line_obj.search(cr, | ||
490 | 136 | uid, | ||
491 | 137 | [('invoice_id', '=', line.id)], | ||
492 | 138 | context=context) | ||
493 | 139 | |||
494 | 140 | if product_ids: | ||
495 | 141 | for product in account_invoice_line_obj.browse(cr, | ||
496 | 142 | uid, | ||
497 | 143 | product_ids, | ||
498 | 144 | context=context): | ||
499 | 145 | item_number = unicode(product.name, "utf8", "replace") \ | ||
500 | 146 | if isinstance(product.name, str) else unicodedata.normalize('NFD', product.name) | ||
501 | 147 | quantity = str(product.quantity) | ||
502 | 148 | price = str(product.price_unit) | ||
503 | 149 | amount = product.quantity * product.price_unit | ||
504 | 150 | amount = str(round(amount, decimal_precision_obj.precision_get(cr, uid, 'Account'))) | ||
505 | 151 | fields_one_product_invoice = [item_number, quantity, price, amount] | ||
506 | 152 | one_product_invoice = ','.join(['"%s"' % field_one_product_invoice | ||
507 | 153 | for field_one_product_invoice in fields_one_product_invoice]) | ||
508 | 154 | one_product_invoice = one_product_invoice.encode('UTF-8') | ||
509 | 155 | tax_product_line = "" | ||
510 | 156 | # Tax information for each product | ||
511 | 157 | if product.invoice_line_tax_id: | ||
512 | 158 | for one_tax in product.invoice_line_tax_id: | ||
513 | 159 | tax_name = one_tax.description # or one_tax.description or one_tax.name | ||
514 | 160 | # 1=yes, 0=No | ||
515 | 161 | tax_included = str(1) if one_tax.price_include else str(0) | ||
516 | 162 | tax_refundable = str(1) # 1=yes, 0=No | ||
517 | 163 | tax_rate = str(one_tax.amount) | ||
518 | 164 | tax_amount = str(one_tax.amount) | ||
519 | 165 | fields_tax_product_line = [tax_name, tax_included, tax_refundable, tax_rate, tax_amount, ] | ||
520 | 166 | tax_product_line = ',' + ','.join(['"%s"' % one_tax_field | ||
521 | 167 | for one_tax_field in fields_tax_product_line]) | ||
522 | 168 | tax_product_line = tax_product_line.encode('UTF-8') | ||
523 | 169 | product_line_invoice_with_tax += one_product_invoice + tax_product_line + '\n' | ||
524 | 170 | output += product_line_invoice_with_tax | ||
525 | 171 | # End of invoice lines | ||
526 | 172 | output += '</SalInvoice>\n\n\n' | ||
527 | 173 | this.format = 'imp' | ||
528 | 174 | filename = 'export_to_sage50' | ||
529 | 175 | this.name = "%s.%s" % (filename, this.format) | ||
530 | 176 | out = base64.encodestring(output) | ||
531 | 177 | self.write(cr, uid, ids, {'state': 'get', 'data': out, 'name': this.name, | ||
532 | 178 | 'format': this.format}, context=context) | ||
533 | 179 | |||
534 | 180 | return { | ||
535 | 181 | 'type': 'ir.actions.act_window', | ||
536 | 182 | 'res_model': 'exportsage', | ||
537 | 183 | 'view_mode': 'form', | ||
538 | 184 | 'view_type': 'form', | ||
539 | 185 | 'res_id': this.id, | ||
540 | 186 | 'views': [(False, 'form')], | ||
541 | 187 | 'target': 'new', | ||
542 | 188 | } | ||
543 | 189 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
544 | 0 | 190 | ||
545 | === added file 'exportsage50/wizard/exportsage50_view.xml' | |||
546 | --- exportsage50/wizard/exportsage50_view.xml 1970-01-01 00:00:00 +0000 | |||
547 | +++ exportsage50/wizard/exportsage50_view.xml 2014-01-17 23:22:31 +0000 | |||
548 | @@ -0,0 +1,47 @@ | |||
549 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
550 | 2 | <openerp> | ||
551 | 3 | <data> | ||
552 | 4 | <record id="account_invoice_generate_export_view" model="ir.ui.view"> | ||
553 | 5 | <field name="name">Export to Sage50</field> | ||
554 | 6 | <field name="model">exportsage</field> | ||
555 | 7 | <field name="arch" type="xml"> | ||
556 | 8 | <form string="Export to Sage50" version="7.0"> | ||
557 | 9 | <field invisible="1" name="state"/> | ||
558 | 10 | <field invisible="1" name="format"/> | ||
559 | 11 | <label string="This action allows you to export accounting data from OpenErp | ||
560 | 12 | to Simply account.You should have the same configuration about the tax information"/> | ||
561 | 13 | <group states="choose" string="Export Settings"> | ||
562 | 14 | <field name="invoice_ids" colspan="4" nolabel="1"/> | ||
563 | 15 | </group> | ||
564 | 16 | <div states="get"> | ||
565 | 17 | <h2>Export Complete</h2> | ||
566 | 18 | <p>Here is the exported file: <field name="data" readonly="1" filename="name"/></p> | ||
567 | 19 | <p>This file was generated using the universal | ||
568 | 20 | <strong>Unicode/UTF-8</strong> | ||
569 | 21 | file encoding, please be sure to view and edit using the same encoding. | ||
570 | 22 | </p> | ||
571 | 23 | </div> | ||
572 | 24 | <footer states="choose"> | ||
573 | 25 | <button name="create_report" string="Export" type="object" class="oe_highlight"/> | ||
574 | 26 | or | ||
575 | 27 | <button special="cancel" string="Cancel" type="object" class="oe_link"/> | ||
576 | 28 | </footer> | ||
577 | 29 | <footer states="get"> | ||
578 | 30 | <button special="cancel" string="Close" type="object"/> | ||
579 | 31 | </footer> | ||
580 | 32 | </form> | ||
581 | 33 | </field> | ||
582 | 34 | </record> | ||
583 | 35 | <record id="action_account_invoice_generate_export_view" model="ir.actions.act_window"> | ||
584 | 36 | <field name="name">Export accounting data to Sage50</field> | ||
585 | 37 | <field name="type">ir.actions.act_window</field> | ||
586 | 38 | <field name="res_model">exportsage</field> | ||
587 | 39 | <field name="view_type">form</field> | ||
588 | 40 | <field name="view_mode">form</field> | ||
589 | 41 | <field name="target">new</field> | ||
590 | 42 | </record> | ||
591 | 43 | <menuitem action="action_account_invoice_generate_export_view" | ||
592 | 44 | id="menu_account_invoice_generate_export_view" | ||
593 | 45 | parent="account.menu_finance_legal_statement"/> | ||
594 | 46 | </data> | ||
595 | 47 | </openerp> | ||
596 | 0 | \ No newline at end of file | 48 | \ No newline at end of file |
Hi eh.dem,
l.157.158.161 - On the 7.0 it's better to use the keywords data and demo instead of init_xml, update_xml and demo_xml.
l.366.377 - osv.osv is deprecated. Use "from openerp.osv import fields, orm" and "class exportsage( orm.Model) ".