Merge lp:~savoirfairelinux-openerp/knowledge-addons/document_multiple_records into lp:knowledge-addons/7.0
- document_multiple_records
- Merge into 7.0
Status: | Rejected |
---|---|
Rejected by: | Sandy Carter (http://www.savoirfairelinux.com) |
Proposed branch: | lp:~savoirfairelinux-openerp/knowledge-addons/document_multiple_records |
Merge into: | lp:knowledge-addons/7.0 |
Diff against target: |
782 lines (+715/-0) 12 files modified
document_multiple_records/__init__.py (+26/-0) document_multiple_records/__openerp__.py (+60/-0) document_multiple_records/document.py (+89/-0) document_multiple_records/document_view.xml (+30/-0) document_multiple_records/i18n/document_multiple_records.pot (+140/-0) document_multiple_records/i18n/fr.po (+151/-0) document_multiple_records/security/ir.model.access.csv (+3/-0) document_multiple_records/static/src/js/document.js (+79/-0) document_multiple_records/static/src/xml/document.xml (+10/-0) document_multiple_records/wizard/__init__.py (+25/-0) document_multiple_records/wizard/document_wizard.py (+61/-0) document_multiple_records/wizard/document_wizard_view.xml (+41/-0) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/knowledge-addons/document_multiple_records |
Related bugs: | |
Related blueprints: |
Attach same document to multiple records
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sandy Carter (http://www.savoirfairelinux.com) | Needs Resubmitting | ||
Holger Brunn (Therp) | code review | Approve | |
OpenERP Community Reviewer/Maintainer | Pending | ||
Review via email: mp+206960@code.launchpad.net |
Commit message
Description of the change
Added document_
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : | # |
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) : | # |
Holger Brunn (Therp) (hbrunn) wrote : | # |
Thanks for taking some of my points into account. A new iteration:
#138 use .copy() for a shallow copy of a dict
#138, #140 'in' applied to dicts checks for keys, no need to create a new keys() list
#154 not all models declare a name property, consider using name_get()
#165 this context keys are very general. Better use some prefix to avoid unintentional clashes
#166ff why the loop?
#171 this yields a warning, better use 'in'
#194 add ondelete='cascade'
And please push your changes over the current branch, otherwise you'll lose all comments as last time
Holger Brunn (Therp) (hbrunn) wrote : | # |
...that should be 'needs fixing'
- 25. By Marc Cassuto (SFL)
-
[i18n] Added french translations
- 26. By Marc Cassuto (SFL)
-
[i18n] Updated french translations
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : | # |
@Holger, took your comments into consideration
Taking myself out of the Reviewer list since I have contributed.
- 27. By Sandy Carter (http://www.savoirfairelinux.com)
-
Add missing access rights
- 28. By Sandy Carter (http://www.savoirfairelinux.com)
-
Cleanup code and fix possible bugs
create():
Avoid duplicating data locally
Fix boolean comparison problem
Use name_get rather than name field
unlink():
Use more specific context identifiers
Remove redundant loop and if statement
model:
Add ondelete='cascade'
Holger Brunn (Therp) (hbrunn) wrote : | # |
Thanks! I think to make this module great, we still need to delete otherwise orphaned attachments when deleting the last referring record. But that's perfectly fine to do in version 0.2
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) : | # |
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : | # |
This MP have been moved to MP to https:/
Unmerged revisions
- 28. By Sandy Carter (http://www.savoirfairelinux.com)
-
Cleanup code and fix possible bugs
create():
Avoid duplicating data locally
Fix boolean comparison problem
Use name_get rather than name field
unlink():
Use more specific context identifiers
Remove redundant loop and if statement
model:
Add ondelete='cascade' - 27. By Sandy Carter (http://www.savoirfairelinux.com)
-
Add missing access rights
- 26. By Marc Cassuto (SFL)
-
[i18n] Updated french translations
- 25. By Marc Cassuto (SFL)
-
[i18n] Added french translations
- 24. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP]Change condition to pass test
- 23. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP]Change condition to pass test
- 22. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP]Fix bug to pass tests
- 21. By El Hadji Dem (http://www.savoirfairelinux.com)
-
[IMP] Refresh automatically list of documents in the form view;from knownlege, delete the documents and references; when delete document from form view, juste delete the reference; informations about the model are saved in the attachment_
document_ ids - 20. By Joao Alfredo Gama Batista
-
[IMP] More clear message for the user
- 19. By Joao Alfredo Gama Batista
-
[FIX] Use attachment_
document_ ids to get list of attachments
Preview Diff
1 | === added directory 'document_multiple_records' | |||
2 | === added file 'document_multiple_records/__init__.py' | |||
3 | --- document_multiple_records/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ document_multiple_records/__init__.py 2014-04-17 00:23:10 +0000 | |||
5 | @@ -0,0 +1,26 @@ | |||
6 | 1 | # -*- encoding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # OpenERP, Open Source Management Solution | ||
10 | 5 | # This module copyright (C) 2014 Savoir-faire Linux | ||
11 | 6 | # (<http://www.savoirfairelinux.com>). | ||
12 | 7 | # | ||
13 | 8 | # This program is free software: you can redistribute it and/or modify | ||
14 | 9 | # it under the terms of the GNU Affero General Public License as | ||
15 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
16 | 11 | # License, or (at your option) any later version. | ||
17 | 12 | # | ||
18 | 13 | # This program is distributed in the hope that it will be useful, | ||
19 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | 16 | # GNU Affero General Public License for more details. | ||
22 | 17 | # | ||
23 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
24 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | 20 | # | ||
26 | 21 | ############################################################################### | ||
27 | 22 | |||
28 | 23 | from . import document | ||
29 | 24 | from . import wizard | ||
30 | 25 | |||
31 | 26 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
32 | 0 | 27 | ||
33 | === added file 'document_multiple_records/__openerp__.py' | |||
34 | --- document_multiple_records/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
35 | +++ document_multiple_records/__openerp__.py 2014-04-17 00:23:10 +0000 | |||
36 | @@ -0,0 +1,60 @@ | |||
37 | 1 | # -*- encoding: utf-8 -*- | ||
38 | 2 | ############################################################################## | ||
39 | 3 | # | ||
40 | 4 | # OpenERP, Open Source Management Solution | ||
41 | 5 | # This module copyright (C) 2014 Savoir-faire Linux | ||
42 | 6 | # (<http://www.savoirfairelinux.com>). | ||
43 | 7 | # | ||
44 | 8 | # This program is free software: you can redistribute it and/or modify | ||
45 | 9 | # it under the terms of the GNU Affero General Public License as | ||
46 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
47 | 11 | # License, or (at your option) any later version. | ||
48 | 12 | # | ||
49 | 13 | # This program is distributed in the hope that it will be useful, | ||
50 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
51 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
52 | 16 | # GNU Affero General Public License for more details. | ||
53 | 17 | # | ||
54 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
55 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
56 | 20 | # | ||
57 | 21 | ############################################################################## | ||
58 | 22 | |||
59 | 23 | { | ||
60 | 24 | 'name': 'Document Management System for Multiple Records', | ||
61 | 25 | 'version': '0.1', | ||
62 | 26 | 'category': 'Knowledge Management', | ||
63 | 27 | 'summary': 'Document Management System for Multiple Records', | ||
64 | 28 | 'description': """ | ||
65 | 29 | Document Management System for Multiple Records | ||
66 | 30 | ============================================== | ||
67 | 31 | |||
68 | 32 | Contributors | ||
69 | 33 | ------------ | ||
70 | 34 | * El Hadji Dem (elhadji.dem@savoirfairelinux.com) | ||
71 | 35 | """, | ||
72 | 36 | 'author': 'Savoir-faire Linux', | ||
73 | 37 | 'website': 'www.savoirfairelinux.com', | ||
74 | 38 | 'license': 'AGPL-3', | ||
75 | 39 | 'depends': [ | ||
76 | 40 | 'document', | ||
77 | 41 | ], | ||
78 | 42 | 'data': [ | ||
79 | 43 | 'document_view.xml', | ||
80 | 44 | 'security/ir.model.access.csv', | ||
81 | 45 | 'wizard/document_wizard_view.xml', | ||
82 | 46 | ], | ||
83 | 47 | 'js': [ | ||
84 | 48 | 'static/src/js/document.js' | ||
85 | 49 | ], | ||
86 | 50 | 'qweb': [ | ||
87 | 51 | 'static/src/xml/document.xml' | ||
88 | 52 | ], | ||
89 | 53 | 'test': [], | ||
90 | 54 | 'demo': [ | ||
91 | 55 | ], | ||
92 | 56 | 'installable': True, | ||
93 | 57 | 'auto_install': False, | ||
94 | 58 | } | ||
95 | 59 | |||
96 | 60 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
97 | 0 | 61 | ||
98 | === added file 'document_multiple_records/document.py' | |||
99 | --- document_multiple_records/document.py 1970-01-01 00:00:00 +0000 | |||
100 | +++ document_multiple_records/document.py 2014-04-17 00:23:10 +0000 | |||
101 | @@ -0,0 +1,89 @@ | |||
102 | 1 | # -*- encoding: utf-8 -*- | ||
103 | 2 | ############################################################################## | ||
104 | 3 | # | ||
105 | 4 | # OpenERP, Open Source Management Solution | ||
106 | 5 | # This module copyright (C) 2014 Savoir-faire Linux | ||
107 | 6 | # (<http://www.savoirfairelinux.com>). | ||
108 | 7 | # | ||
109 | 8 | # This program is free software: you can redistribute it and/or modify | ||
110 | 9 | # it under the terms of the GNU Affero General Public License as | ||
111 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
112 | 11 | # License, or (at your option) any later version. | ||
113 | 12 | # | ||
114 | 13 | # This program is distributed in the hope that it will be useful, | ||
115 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
116 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
117 | 16 | # GNU Affero General Public License for more details. | ||
118 | 17 | # | ||
119 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
120 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
121 | 20 | # | ||
122 | 21 | ############################################################################## | ||
123 | 22 | |||
124 | 23 | from openerp.osv import orm, fields | ||
125 | 24 | |||
126 | 25 | |||
127 | 26 | class document_file(orm.Model): | ||
128 | 27 | _inherit = 'ir.attachment' | ||
129 | 28 | |||
130 | 29 | _columns = { | ||
131 | 30 | 'attachment_document_ids': fields.one2many('ir.attachment.document', | ||
132 | 31 | 'attachment_id', | ||
133 | 32 | 'Records'), | ||
134 | 33 | } | ||
135 | 34 | |||
136 | 35 | def create(self, cr, uid, data, context=None): | ||
137 | 36 | ir_attachment_document_obj = self.pool.get('ir.attachment.document') | ||
138 | 37 | res = super(document_file, self).create(cr, uid, data, context=context) | ||
139 | 38 | # Create attachment_document_ids with res_model, res_id and res_name | ||
140 | 39 | if 'res_model' in data and 'res_id' in data: | ||
141 | 40 | ir_attachment_document_obj.create(cr, uid, { | ||
142 | 41 | 'attachment_id': res, | ||
143 | 42 | 'res_model': data['res_model'], | ||
144 | 43 | 'res_id': data['res_id'], | ||
145 | 44 | 'res_name': data.get( | ||
146 | 45 | 'res_name', self.pool.get(data['res_model']).browse( | ||
147 | 46 | cr, uid, data['res_id'], | ||
148 | 47 | context=context).name_get()[0][1]), | ||
149 | 48 | }, context=context) | ||
150 | 49 | return res | ||
151 | 50 | |||
152 | 51 | def unlink(self, cr, uid, ids, context=None, check=True): | ||
153 | 52 | ir_attach_doc_obj = self.pool.get('ir.attachment.document') | ||
154 | 53 | if context is None: | ||
155 | 54 | context = {} | ||
156 | 55 | # Deleting from dropdown list in the form view | ||
157 | 56 | res_model = context.get('multiple_records_res_model') | ||
158 | 57 | res_id = context.get('multiple_records_res_id') | ||
159 | 58 | if res_model and res_id: | ||
160 | 59 | query = [ | ||
161 | 60 | ('res_model', '=', res_model), | ||
162 | 61 | ('res_id', '=', res_id), | ||
163 | 62 | ('attachment_id', 'in', ids), | ||
164 | 63 | ] | ||
165 | 64 | ids_to_unlink = ir_attach_doc_obj.search( | ||
166 | 65 | cr, uid, query, context=context) | ||
167 | 66 | result = ir_attach_doc_obj.unlink( | ||
168 | 67 | cr, uid, ids_to_unlink, context=context) | ||
169 | 68 | else: | ||
170 | 69 | # Normal delete | ||
171 | 70 | result = super(document_file, self).unlink(cr, uid, ids, context=context) | ||
172 | 71 | return result | ||
173 | 72 | |||
174 | 73 | |||
175 | 74 | class ir_attachment_document(orm.Model): | ||
176 | 75 | _description = 'Attachment Documents' | ||
177 | 76 | _name = 'ir.attachment.document' | ||
178 | 77 | |||
179 | 78 | _columns = { | ||
180 | 79 | 'res_id': fields.integer('Resource ID', readonly=True, | ||
181 | 80 | help="The record id this is attached to."), | ||
182 | 81 | 'res_model': fields.char('Resource Model', size=64, | ||
183 | 82 | readonly=True, | ||
184 | 83 | help="The database object this attachment will be attached to"), | ||
185 | 84 | 'res_name': fields.char('Resource Name', type='char', | ||
186 | 85 | size=128, | ||
187 | 86 | readonly=True), | ||
188 | 87 | 'attachment_id': fields.many2one( | ||
189 | 88 | 'ir.attachment', 'Attachment', ondelete='cascade'), | ||
190 | 89 | } | ||
191 | 0 | 90 | ||
192 | === added file 'document_multiple_records/document_view.xml' | |||
193 | --- document_multiple_records/document_view.xml 1970-01-01 00:00:00 +0000 | |||
194 | +++ document_multiple_records/document_view.xml 2014-04-17 00:23:10 +0000 | |||
195 | @@ -0,0 +1,30 @@ | |||
196 | 1 | <?xml version="1.0"?> | ||
197 | 2 | <openerp> | ||
198 | 3 | <data> | ||
199 | 4 | <!--Add model list field--> | ||
200 | 5 | <record model="ir.ui.view" id="view_document_file_multiple_models_form"> | ||
201 | 6 | <field name="name">ir.attachment.multiple.models</field> | ||
202 | 7 | <field name="model">ir.attachment</field> | ||
203 | 8 | <field name="inherit_id" ref="document.view_document_file_form"/> | ||
204 | 9 | <field name="arch" type="xml"> | ||
205 | 10 | <group string="Indexed Content" position="after"> | ||
206 | 11 | <group col="2" colspan="4"> | ||
207 | 12 | <field name="attachment_document_ids" nolabel="1"> | ||
208 | 13 | <tree string="AttachmentDocumentTree" create="false" version="7.0"> | ||
209 | 14 | <field name="res_model"/> | ||
210 | 15 | <field name="res_id"/> | ||
211 | 16 | <field name="res_name"/> | ||
212 | 17 | </tree> | ||
213 | 18 | <form string="AttachmentDocumentForm"> | ||
214 | 19 | <field name="res_model"/> | ||
215 | 20 | <field name="res_id"/> | ||
216 | 21 | <field name="res_name"/> | ||
217 | 22 | </form> | ||
218 | 23 | </field> | ||
219 | 24 | </group> | ||
220 | 25 | </group> | ||
221 | 26 | </field> | ||
222 | 27 | </record> | ||
223 | 28 | </data> | ||
224 | 29 | </openerp> | ||
225 | 30 | |||
226 | 0 | 31 | ||
227 | === added directory 'document_multiple_records/i18n' | |||
228 | === added file 'document_multiple_records/i18n/document_multiple_records.pot' | |||
229 | --- document_multiple_records/i18n/document_multiple_records.pot 1970-01-01 00:00:00 +0000 | |||
230 | +++ document_multiple_records/i18n/document_multiple_records.pot 2014-04-17 00:23:10 +0000 | |||
231 | @@ -0,0 +1,140 @@ | |||
232 | 1 | # Translation of OpenERP Server. | ||
233 | 2 | # This file contains the translation of the following modules: | ||
234 | 3 | # * document_multiple_records | ||
235 | 4 | # | ||
236 | 5 | msgid "" | ||
237 | 6 | msgstr "" | ||
238 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
239 | 8 | "Report-Msgid-Bugs-To: \n" | ||
240 | 9 | "POT-Creation-Date: 2014-02-06 19:28+0000\n" | ||
241 | 10 | "PO-Revision-Date: 2014-02-06 14:29-0500\n" | ||
242 | 11 | "Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n" | ||
243 | 12 | "Language-Team: \n" | ||
244 | 13 | "MIME-Version: 1.0\n" | ||
245 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
246 | 15 | "Content-Transfer-Encoding: 8bit\n" | ||
247 | 16 | "Plural-Forms: \n" | ||
248 | 17 | "X-Generator: Poedit 1.5.4\n" | ||
249 | 18 | |||
250 | 19 | #. module: document_multiple_records | ||
251 | 20 | #: field:ir.attachment.document,res_id:0 | ||
252 | 21 | msgid "Resource ID" | ||
253 | 22 | msgstr "" | ||
254 | 23 | |||
255 | 24 | #. module: document_multiple_records | ||
256 | 25 | #: view:ir.attachment.wizard:0 | ||
257 | 26 | msgid "Select document(s)" | ||
258 | 27 | msgstr "" | ||
259 | 28 | |||
260 | 29 | #. module: document_multiple_records | ||
261 | 30 | #. openerp-web | ||
262 | 31 | #: code:addons/document_multiple_records/static/src/xml/document.xml:7 | ||
263 | 32 | #, python-format | ||
264 | 33 | msgid "Add existing Doc..." | ||
265 | 34 | msgstr "" | ||
266 | 35 | |||
267 | 36 | #. module: document_multiple_records | ||
268 | 37 | #: field:ir.attachment.document,attachment_id:0 | ||
269 | 38 | msgid "Attachment" | ||
270 | 39 | msgstr "" | ||
271 | 40 | |||
272 | 41 | #. module: document_multiple_records | ||
273 | 42 | #: view:ir.attachment.wizard:0 | ||
274 | 43 | msgid "AttachmentDocumentWizardTree" | ||
275 | 44 | msgstr "" | ||
276 | 45 | |||
277 | 46 | #. module: document_multiple_records | ||
278 | 47 | #. openerp-web | ||
279 | 48 | #: code:addons/document_multiple_records/static/src/js/document.js:26 | ||
280 | 49 | #: model:ir.actions.act_window,name:document_multiple_records.action_view_document | ||
281 | 50 | #: view:ir.attachment.wizard:0 | ||
282 | 51 | #, python-format | ||
283 | 52 | msgid "Add Document" | ||
284 | 53 | msgstr "" | ||
285 | 54 | |||
286 | 55 | #. module: document_multiple_records | ||
287 | 56 | #: field:ir.attachment.document,res_name:0 | ||
288 | 57 | msgid "Resource Name" | ||
289 | 58 | msgstr "" | ||
290 | 59 | |||
291 | 60 | #. module: document_multiple_records | ||
292 | 61 | #: model:ir.model,name:document_multiple_records.model_ir_attachment_document | ||
293 | 62 | msgid "Attachment Documents" | ||
294 | 63 | msgstr "" | ||
295 | 64 | |||
296 | 65 | #. module: document_multiple_records | ||
297 | 66 | #: field:ir.attachment,attachmentdocument_ids:0 | ||
298 | 67 | msgid "Records" | ||
299 | 68 | msgstr "" | ||
300 | 69 | |||
301 | 70 | #. module: document_multiple_records | ||
302 | 71 | #: view:ir.attachment:0 | ||
303 | 72 | msgid "AttachmentDocumentTree" | ||
304 | 73 | msgstr "" | ||
305 | 74 | |||
306 | 75 | #. module: document_multiple_records | ||
307 | 76 | #: model:ir.model,name:document_multiple_records.model_ir_attachment | ||
308 | 77 | msgid "ir.attachment" | ||
309 | 78 | msgstr "" | ||
310 | 79 | |||
311 | 80 | #. module: document_multiple_records | ||
312 | 81 | #: view:ir.attachment:0 | ||
313 | 82 | msgid "Indexed Content" | ||
314 | 83 | msgstr "" | ||
315 | 84 | |||
316 | 85 | #. module: document_multiple_records | ||
317 | 86 | #: model:ir.model,name:document_multiple_records.model_ir_attachment_wizard | ||
318 | 87 | msgid "Attachment wizard" | ||
319 | 88 | msgstr "" | ||
320 | 89 | |||
321 | 90 | #. module: document_multiple_records | ||
322 | 91 | #: view:ir.attachment:0 | ||
323 | 92 | msgid "AttachmentDocumentForm" | ||
324 | 93 | msgstr "" | ||
325 | 94 | |||
326 | 95 | #. module: document_multiple_records | ||
327 | 96 | #: code:addons/document_multiple_records/wizard/document_wizard.py:46 | ||
328 | 97 | #, python-format | ||
329 | 98 | msgid "Error" | ||
330 | 99 | msgstr "" | ||
331 | 100 | |||
332 | 101 | #. module: document_multiple_records | ||
333 | 102 | #: help:ir.attachment.document,res_model:0 | ||
334 | 103 | msgid "The database object this attachment will be attached to" | ||
335 | 104 | msgstr "" | ||
336 | 105 | |||
337 | 106 | #. module: document_multiple_records | ||
338 | 107 | #: help:ir.attachment.document,res_id:0 | ||
339 | 108 | msgid "The record id this is attached to." | ||
340 | 109 | msgstr "" | ||
341 | 110 | |||
342 | 111 | #. module: document_multiple_records | ||
343 | 112 | #: field:ir.attachment.wizard,attachment_ids:0 | ||
344 | 113 | msgid "Attachments" | ||
345 | 114 | msgstr "" | ||
346 | 115 | |||
347 | 116 | #. module: document_multiple_records | ||
348 | 117 | #: field:ir.attachment.document,res_model:0 | ||
349 | 118 | msgid "Resource Model" | ||
350 | 119 | msgstr "" | ||
351 | 120 | |||
352 | 121 | #. module: document_multiple_records | ||
353 | 122 | #: view:ir.attachment.wizard:0 | ||
354 | 123 | msgid "Cancel" | ||
355 | 124 | msgstr "" | ||
356 | 125 | |||
357 | 126 | #. module: document_multiple_records | ||
358 | 127 | #: view:ir.attachment.wizard:0 | ||
359 | 128 | msgid "Apply" | ||
360 | 129 | msgstr "" | ||
361 | 130 | |||
362 | 131 | #. module: document_multiple_records | ||
363 | 132 | #: view:ir.attachment.wizard:0 | ||
364 | 133 | msgid "or" | ||
365 | 134 | msgstr "" | ||
366 | 135 | |||
367 | 136 | #. module: document_multiple_records | ||
368 | 137 | #: code:addons/document_multiple_records/wizard/document_wizard.py:47 | ||
369 | 138 | #, python-format | ||
370 | 139 | msgid "You have to select at least 1 Document. And try again" | ||
371 | 140 | msgstr "" | ||
372 | 0 | 141 | ||
373 | === added file 'document_multiple_records/i18n/fr.po' | |||
374 | --- document_multiple_records/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
375 | +++ document_multiple_records/i18n/fr.po 2014-04-17 00:23:10 +0000 | |||
376 | @@ -0,0 +1,151 @@ | |||
377 | 1 | # Translation of OpenERP Server. | ||
378 | 2 | # This file contains the translation of the following modules: | ||
379 | 3 | # * document_multiple_records | ||
380 | 4 | # | ||
381 | 5 | msgid "" | ||
382 | 6 | msgstr "" | ||
383 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
384 | 8 | "Report-Msgid-Bugs-To: \n" | ||
385 | 9 | "POT-Creation-Date: 2014-03-25 18:24+0000\n" | ||
386 | 10 | "PO-Revision-Date: 2014-03-25 14:27-0500\n" | ||
387 | 11 | "Last-Translator: Marc Cassuto <marc.cassuto@savoirfairelinux.com>\n" | ||
388 | 12 | "Language-Team: \n" | ||
389 | 13 | "Language: \n" | ||
390 | 14 | "MIME-Version: 1.0\n" | ||
391 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | ||
392 | 16 | "Content-Transfer-Encoding: 8bit\n" | ||
393 | 17 | "Plural-Forms: \n" | ||
394 | 18 | "X-Generator: Poedit 1.5.4\n" | ||
395 | 19 | |||
396 | 20 | #. module: document_multiple_records | ||
397 | 21 | #: field:ir.attachment.document,res_id:0 | ||
398 | 22 | msgid "Resource ID" | ||
399 | 23 | msgstr "Identifiant de la ressource" | ||
400 | 24 | |||
401 | 25 | #. module: document_multiple_records | ||
402 | 26 | #: view:ir.attachment.existing.doc:0 | ||
403 | 27 | msgid "Select document(s)" | ||
404 | 28 | msgstr "Choisir un(des) document(s)" | ||
405 | 29 | |||
406 | 30 | #. module: document_multiple_records | ||
407 | 31 | #: field:ir.attachment.document,attachment_id:0 | ||
408 | 32 | msgid "Attachment" | ||
409 | 33 | msgstr "Document joint" | ||
410 | 34 | |||
411 | 35 | #. module: document_multiple_records | ||
412 | 36 | #: view:ir.attachment.existing.doc:0 | ||
413 | 37 | msgid "AttachmentDocumentWizardTree" | ||
414 | 38 | msgstr "AttachmentDocumentWizardTree" | ||
415 | 39 | |||
416 | 40 | #. module: document_multiple_records | ||
417 | 41 | #. openerp-web | ||
418 | 42 | #: code:addons/document_multiple_records/static/src/js/document.js:42 | ||
419 | 43 | #, python-format | ||
420 | 44 | msgid "Uploading Error" | ||
421 | 45 | msgstr "Erreur lors du transfert" | ||
422 | 46 | |||
423 | 47 | #. module: document_multiple_records | ||
424 | 48 | #: field:ir.attachment.document,res_name:0 | ||
425 | 49 | msgid "Resource Name" | ||
426 | 50 | msgstr "Nom de la ressource" | ||
427 | 51 | |||
428 | 52 | #. module: document_multiple_records | ||
429 | 53 | #: model:ir.model,name:document_multiple_records.model_ir_attachment_document | ||
430 | 54 | msgid "Attachment Documents" | ||
431 | 55 | msgstr "Documents joints" | ||
432 | 56 | |||
433 | 57 | #. module: document_multiple_records | ||
434 | 58 | #: field:ir.attachment,attachment_document_ids:0 | ||
435 | 59 | msgid "Records" | ||
436 | 60 | msgstr "Enregistrements" | ||
437 | 61 | |||
438 | 62 | #. module: document_multiple_records | ||
439 | 63 | #: view:ir.attachment:0 | ||
440 | 64 | msgid "AttachmentDocumentTree" | ||
441 | 65 | msgstr "AttachmentDocumentTree" | ||
442 | 66 | |||
443 | 67 | #. module: document_multiple_records | ||
444 | 68 | #: model:ir.model,name:document_multiple_records.model_ir_attachment | ||
445 | 69 | msgid "ir.attachment" | ||
446 | 70 | msgstr "ir.attachment" | ||
447 | 71 | |||
448 | 72 | #. module: document_multiple_records | ||
449 | 73 | #: view:ir.attachment:0 | ||
450 | 74 | msgid "Indexed Content" | ||
451 | 75 | msgstr "Contenu indexé" | ||
452 | 76 | |||
453 | 77 | #. module: document_multiple_records | ||
454 | 78 | #: view:ir.attachment:0 | ||
455 | 79 | msgid "AttachmentDocumentForm" | ||
456 | 80 | msgstr "AttachmentDocumentForm" | ||
457 | 81 | |||
458 | 82 | #. module: document_multiple_records | ||
459 | 83 | #: code:addons/document_multiple_records/wizard/document_wizard.py:48 | ||
460 | 84 | #, python-format | ||
461 | 85 | msgid "Error" | ||
462 | 86 | msgstr "Erreur" | ||
463 | 87 | |||
464 | 88 | #. module: document_multiple_records | ||
465 | 89 | #: help:ir.attachment.document,res_model:0 | ||
466 | 90 | msgid "The database object this attachment will be attached to" | ||
467 | 91 | msgstr "L'objet de la base de données auquel ce document sera attaché" | ||
468 | 92 | |||
469 | 93 | #. module: document_multiple_records | ||
470 | 94 | #: help:ir.attachment.document,res_id:0 | ||
471 | 95 | msgid "The record id this is attached to." | ||
472 | 96 | msgstr "L'identifiant de l'enregistrement auquel est ce document est joint." | ||
473 | 97 | |||
474 | 98 | #. module: document_multiple_records | ||
475 | 99 | #. openerp-web | ||
476 | 100 | #: code:addons/document_multiple_records/static/src/js/document.js:25 | ||
477 | 101 | #: model:ir.actions.act_window,name:document_multiple_records.action_view_document | ||
478 | 102 | #: view:ir.attachment.existing.doc:0 | ||
479 | 103 | #, python-format | ||
480 | 104 | msgid "Add existing document/attachment" | ||
481 | 105 | msgstr "Ajouter un document déjà joint dans le système" | ||
482 | 106 | |||
483 | 107 | #. module: document_multiple_records | ||
484 | 108 | #: model:ir.model,name:document_multiple_records.model_ir_attachment_existing_doc | ||
485 | 109 | msgid "Add existing document/attachment wizard" | ||
486 | 110 | msgstr "Assistant pour ajouter un document déjà joint dans le système" | ||
487 | 111 | |||
488 | 112 | #. module: document_multiple_records | ||
489 | 113 | #: field:ir.attachment.existing.doc,attachment_ids:0 | ||
490 | 114 | msgid "Attachments" | ||
491 | 115 | msgstr "Documents joints" | ||
492 | 116 | |||
493 | 117 | #. module: document_multiple_records | ||
494 | 118 | #. openerp-web | ||
495 | 119 | #: code:addons/document_multiple_records/static/src/xml/document.xml:7 | ||
496 | 120 | #, python-format | ||
497 | 121 | msgid "Add existing document/attachment..." | ||
498 | 122 | msgstr "Ajouter un document déjà joint dans le système..." | ||
499 | 123 | |||
500 | 124 | #. module: document_multiple_records | ||
501 | 125 | #: field:ir.attachment.document,res_model:0 | ||
502 | 126 | msgid "Resource Model" | ||
503 | 127 | msgstr "Modèle" | ||
504 | 128 | |||
505 | 129 | #. module: document_multiple_records | ||
506 | 130 | #: view:ir.attachment.existing.doc:0 | ||
507 | 131 | msgid "Cancel" | ||
508 | 132 | msgstr "Annuler" | ||
509 | 133 | |||
510 | 134 | #. module: document_multiple_records | ||
511 | 135 | #: view:ir.attachment.existing.doc:0 | ||
512 | 136 | msgid "Apply" | ||
513 | 137 | msgstr "Appliquer" | ||
514 | 138 | |||
515 | 139 | #. module: document_multiple_records | ||
516 | 140 | #: view:ir.attachment.existing.doc:0 | ||
517 | 141 | msgid "or" | ||
518 | 142 | msgstr "ou" | ||
519 | 143 | |||
520 | 144 | #. module: document_multiple_records | ||
521 | 145 | #: code:addons/document_multiple_records/wizard/document_wizard.py:49 | ||
522 | 146 | #, python-format | ||
523 | 147 | msgid "You have to select at least 1 Document. And try again" | ||
524 | 148 | msgstr "Vous devez sélectionner au moins un document et essayer de nouveau." | ||
525 | 149 | |||
526 | 150 | #~ msgid "Add Document" | ||
527 | 151 | #~ msgstr "Ajouter un document" | ||
528 | 0 | 152 | ||
529 | === added directory 'document_multiple_records/security' | |||
530 | === added file 'document_multiple_records/security/ir.model.access.csv' | |||
531 | --- document_multiple_records/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
532 | +++ document_multiple_records/security/ir.model.access.csv 2014-04-17 00:23:10 +0000 | |||
533 | @@ -0,0 +1,3 @@ | |||
534 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
535 | 2 | access_ir_attachment_document_group_user,ir.attachment.document user,model_ir_attachment_document,base.group_document_user,1,1,1,1 | ||
536 | 3 | access_ir_attachment_existing_doc,access_ir_attachment_existing_doc,model_ir_attachment_existing_doc,base.group_document_user,1,1,1,1 | ||
537 | 0 | 4 | ||
538 | === added directory 'document_multiple_records/static' | |||
539 | === added directory 'document_multiple_records/static/src' | |||
540 | === added directory 'document_multiple_records/static/src/js' | |||
541 | === added file 'document_multiple_records/static/src/js/document.js' | |||
542 | --- document_multiple_records/static/src/js/document.js 1970-01-01 00:00:00 +0000 | |||
543 | +++ document_multiple_records/static/src/js/document.js 2014-04-17 00:23:10 +0000 | |||
544 | @@ -0,0 +1,79 @@ | |||
545 | 1 | openerp.document_multiple_records = function(instance, m) { | ||
546 | 2 | var _t = instance.web._t, | ||
547 | 3 | QWeb = instance.web.qweb; | ||
548 | 4 | |||
549 | 5 | instance.web.Sidebar.include({ | ||
550 | 6 | redraw: function() { | ||
551 | 7 | var self = this; | ||
552 | 8 | this._super.apply(this, arguments); | ||
553 | 9 | self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddDocfromserver', {widget: self})) | ||
554 | 10 | self.$el.find('.open').on('click', function (e) { | ||
555 | 11 | self.on_call_new_view_function(); | ||
556 | 12 | }); | ||
557 | 13 | }, | ||
558 | 14 | on_call_new_view_function: function(state) { | ||
559 | 15 | var self = this; | ||
560 | 16 | var view = self.getParent(); | ||
561 | 17 | var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ]; | ||
562 | 18 | // you can pass in other data using the context dictionary variable | ||
563 | 19 | var context = { | ||
564 | 20 | 'model': view.dataset.model, | ||
565 | 21 | 'ids': ids, | ||
566 | 22 | }; | ||
567 | 23 | // the action dictionary variable sends data in the "self.do_action" method | ||
568 | 24 | var action = { | ||
569 | 25 | name: _t("Add existing document"), | ||
570 | 26 | type: 'ir.actions.act_window', | ||
571 | 27 | res_model: 'ir.attachment.existing.doc', | ||
572 | 28 | view_mode: 'form', | ||
573 | 29 | view_type: 'form', | ||
574 | 30 | views: [[false, 'form']], | ||
575 | 31 | target: 'new', | ||
576 | 32 | context: context, | ||
577 | 33 | }; | ||
578 | 34 | // self.do_action accepts the action parameter and opens the new view | ||
579 | 35 | self.do_action(action, { | ||
580 | 36 | // refresh list of documents | ||
581 | 37 | on_close: function () { | ||
582 | 38 | self.do_attachement_update(self.dataset, self.model_id); | ||
583 | 39 | } | ||
584 | 40 | }); | ||
585 | 41 | |||
586 | 42 | }, | ||
587 | 43 | on_attachment_delete: function(e) { | ||
588 | 44 | e.preventDefault(); | ||
589 | 45 | e.stopPropagation(); | ||
590 | 46 | var self = this; | ||
591 | 47 | var view = self.getParent(); | ||
592 | 48 | self.model_view = view.dataset.model | ||
593 | 49 | var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ]; | ||
594 | 50 | // Context dictionary variable | ||
595 | 51 | var context = { | ||
596 | 52 | 'multiple_records_res_model': self.model_view, | ||
597 | 53 | 'multiple_records_res_id': ids[0], | ||
598 | 54 | }; | ||
599 | 55 | var $e = $(e.currentTarget); | ||
600 | 56 | if (confirm(_t("Do you really want to delete this attachment ?"))) { | ||
601 | 57 | (new instance.web.DataSet(this, 'ir.attachment', context)).unlink([parseInt($e.attr('data-id'), 10)]).done(function() { | ||
602 | 58 | self.do_attachement_update(self.dataset, self.model_id); | ||
603 | 59 | }); | ||
604 | 60 | } | ||
605 | 61 | }, | ||
606 | 62 | do_attachement_update: function(dataset, model_id, args) { | ||
607 | 63 | var self = this; | ||
608 | 64 | this.dataset = dataset; | ||
609 | 65 | this.model_id = model_id; | ||
610 | 66 | if (args && args[0].error) { | ||
611 | 67 | this.do_warn(_t('Uploading Error'), args[0].error); | ||
612 | 68 | } | ||
613 | 69 | if (!model_id) { | ||
614 | 70 | this.on_attachments_loaded([]); | ||
615 | 71 | } | ||
616 | 72 | else { | ||
617 | 73 | var dom = [ ['attachment_document_ids.res_model', '=', dataset.model], ['attachment_document_ids.res_id', '=', model_id], ['type', 'in', ['binary', 'url']] ]; | ||
618 | 74 | var ds = new instance.web.DataSetSearch(this, 'ir.attachment', dataset.get_context(), dom); | ||
619 | 75 | ds.read_slice(['name', 'url', 'type', 'create_uid', 'create_date', 'write_uid', 'write_date'], {}).done(this.on_attachments_loaded); | ||
620 | 76 | } | ||
621 | 77 | } | ||
622 | 78 | }); | ||
623 | 79 | }; | ||
624 | 0 | 80 | ||
625 | === added directory 'document_multiple_records/static/src/xml' | |||
626 | === added file 'document_multiple_records/static/src/xml/document.xml' | |||
627 | --- document_multiple_records/static/src/xml/document.xml 1970-01-01 00:00:00 +0000 | |||
628 | +++ document_multiple_records/static/src/xml/document.xml 2014-04-17 00:23:10 +0000 | |||
629 | @@ -0,0 +1,10 @@ | |||
630 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
631 | 2 | <!-- vim:fdl=1: | ||
632 | 3 | --> | ||
633 | 4 | <templates id="template" xml:space="preserve"> | ||
634 | 5 | |||
635 | 6 | <t t-name="AddDocfromserver"> | ||
636 | 7 | <li class="open"><span><b>Add existing document...</b></span></li> | ||
637 | 8 | </t> | ||
638 | 9 | |||
639 | 10 | </templates> | ||
640 | 0 | 11 | ||
641 | === added directory 'document_multiple_records/wizard' | |||
642 | === added file 'document_multiple_records/wizard/__init__.py' | |||
643 | --- document_multiple_records/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
644 | +++ document_multiple_records/wizard/__init__.py 2014-04-17 00:23:10 +0000 | |||
645 | @@ -0,0 +1,25 @@ | |||
646 | 1 | # -*- encoding: utf-8 -*- | ||
647 | 2 | ############################################################################## | ||
648 | 3 | # | ||
649 | 4 | # OpenERP, Open Source Management Solution | ||
650 | 5 | # This module copyright (C) 2014 Savoir-faire Linux | ||
651 | 6 | # (<http://www.savoirfairelinux.com>). | ||
652 | 7 | # | ||
653 | 8 | # This program is free software: you can redistribute it and/or modify | ||
654 | 9 | # it under the terms of the GNU Affero General Public License as | ||
655 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
656 | 11 | # License, or (at your option) any later version. | ||
657 | 12 | # | ||
658 | 13 | # This program is distributed in the hope that it will be useful, | ||
659 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
660 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
661 | 16 | # GNU Affero General Public License for more details. | ||
662 | 17 | # | ||
663 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
664 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
665 | 20 | # | ||
666 | 21 | ############################################################################## | ||
667 | 22 | |||
668 | 23 | from . import document_wizard | ||
669 | 24 | |||
670 | 25 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
671 | 0 | 26 | ||
672 | === added file 'document_multiple_records/wizard/document_wizard.py' | |||
673 | --- document_multiple_records/wizard/document_wizard.py 1970-01-01 00:00:00 +0000 | |||
674 | +++ document_multiple_records/wizard/document_wizard.py 2014-04-17 00:23:10 +0000 | |||
675 | @@ -0,0 +1,61 @@ | |||
676 | 1 | # -*- encoding: utf-8 -*- | ||
677 | 2 | ############################################################################## | ||
678 | 3 | # | ||
679 | 4 | # OpenERP, Open Source Management Solution | ||
680 | 5 | # This module copyright (C) 2014 Savoir-faire Linux | ||
681 | 6 | # (<http://www.savoirfairelinux.com>). | ||
682 | 7 | # | ||
683 | 8 | # This program is free software: you can redistribute it and/or modify | ||
684 | 9 | # it under the terms of the GNU Affero General Public License as | ||
685 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
686 | 11 | # License, or (at your option) any later version. | ||
687 | 12 | # | ||
688 | 13 | # This program is distributed in the hope that it will be useful, | ||
689 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
690 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
691 | 16 | # GNU Affero General Public License for more details. | ||
692 | 17 | # | ||
693 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
694 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
695 | 20 | # | ||
696 | 21 | ############################################################################## | ||
697 | 22 | |||
698 | 23 | from openerp.osv import fields, orm | ||
699 | 24 | from openerp.tools.translate import _ | ||
700 | 25 | |||
701 | 26 | |||
702 | 27 | class document_wizard(orm.Model): | ||
703 | 28 | _name = "ir.attachment.existing.doc" | ||
704 | 29 | _description = "Add existing document/attachment wizard" | ||
705 | 30 | _columns = { | ||
706 | 31 | 'attachment_ids': fields.many2many('ir.attachment', | ||
707 | 32 | 'document_attachment_rel', | ||
708 | 33 | 'wizard_id', | ||
709 | 34 | 'attachment_id', | ||
710 | 35 | 'Attachments'), | ||
711 | 36 | } | ||
712 | 37 | |||
713 | 38 | def action_apply(self, cr, uid, ids, context=None): | ||
714 | 39 | if context is None: | ||
715 | 40 | context = {} | ||
716 | 41 | ir_attach_obj = self.pool.get('ir.attachment') | ||
717 | 42 | ir_attach_doc_obj = self.pool.get('ir.attachment.document') | ||
718 | 43 | ir_model_obj = self.pool.get(context.get('model') or context.get('active_model')) | ||
719 | 44 | |||
720 | 45 | name = ir_model_obj.browse(cr, uid, context.get('ids') or context.get('active_ids'), context=context)[0]['name'] | ||
721 | 46 | data = self.read(cr, uid, ids, [], context=context)[0] | ||
722 | 47 | if not data['attachment_ids']: | ||
723 | 48 | raise orm.except_orm(_('Error'), | ||
724 | 49 | _('You have to select at least 1 Document. And try again')) | ||
725 | 50 | for attach in ir_attach_obj.browse(cr, uid, data['attachment_ids'], context=context): | ||
726 | 51 | data_attach = { | ||
727 | 52 | 'res_model': context.get('model') or context.get('active_model'), | ||
728 | 53 | 'res_id': context.get('ids') and context.get('ids')[0] or context.get('active_id'), | ||
729 | 54 | 'res_name': name, | ||
730 | 55 | 'attachment_id': attach.id, | ||
731 | 56 | } | ||
732 | 57 | #Created attachment_document_ids | ||
733 | 58 | ir_attach_doc_obj.create(cr, uid, data_attach, context=context) | ||
734 | 59 | return {'type': 'ir.actions.act_window_close'} | ||
735 | 60 | |||
736 | 61 | # vim:expandtab:smartindent:toabstop=4:softtabstop=4:shiftwidth=4: | ||
737 | 0 | 62 | ||
738 | === added file 'document_multiple_records/wizard/document_wizard_view.xml' | |||
739 | --- document_multiple_records/wizard/document_wizard_view.xml 1970-01-01 00:00:00 +0000 | |||
740 | +++ document_multiple_records/wizard/document_wizard_view.xml 2014-04-17 00:23:10 +0000 | |||
741 | @@ -0,0 +1,41 @@ | |||
742 | 1 | <?xml version="1.0"?> | ||
743 | 2 | <openerp> | ||
744 | 3 | <data> | ||
745 | 4 | |||
746 | 5 | <record id="document_form_view" model="ir.ui.view"> | ||
747 | 6 | <field name="name">Add existing document/attachment</field> | ||
748 | 7 | <field name="model">ir.attachment.existing.doc</field> | ||
749 | 8 | <field name="arch" type="xml"> | ||
750 | 9 | <form string="Add existing document/attachment" version="7.0"> | ||
751 | 10 | <group string="Select document(s)" colspan="4"> | ||
752 | 11 | <field name="attachment_ids" nolabel="1"> | ||
753 | 12 | <tree string="AttachmentDocumentWizardTree"> | ||
754 | 13 | <field name="name"/> | ||
755 | 14 | <field name="create_uid"/> | ||
756 | 15 | <field name="create_date"/> | ||
757 | 16 | <field name="type"/> | ||
758 | 17 | </tree> | ||
759 | 18 | </field> | ||
760 | 19 | </group> | ||
761 | 20 | <footer> | ||
762 | 21 | <button string="Apply" name="action_apply" type="object" class="oe_highlight"/> | ||
763 | 22 | or | ||
764 | 23 | <button string="Cancel" class="oe_link" special="cancel" /> | ||
765 | 24 | </footer> | ||
766 | 25 | </form> | ||
767 | 26 | </field> | ||
768 | 27 | </record> | ||
769 | 28 | |||
770 | 29 | <!-- Actions --> | ||
771 | 30 | <record model="ir.actions.act_window" id="action_view_document"> | ||
772 | 31 | <field name="name">Add existing document/attachment</field> | ||
773 | 32 | <field name="res_model">ir.attachment.existing.doc</field> | ||
774 | 33 | <field name="view_type">form</field> | ||
775 | 34 | <field name="view_mode">tree,form</field> | ||
776 | 35 | <field name="view_id" ref="document_form_view"/> | ||
777 | 36 | <field name="target">new</field> | ||
778 | 37 | </record> | ||
779 | 38 | |||
780 | 39 | </data> | ||
781 | 40 | </openerp> | ||
782 | 41 |
Please fix according to https:/ /code.launchpad .net/~savoirfai relinux- openerp/ knowledge- addons/ add_document_ multiple_ records/ +merge/ 205249/ comments/ 481345
Holger Brunn (Therp) (hbrunn) wrote on 2014-02-10:
I think you should follow the rule to put models into the subdir model, with one file per model.
#29 why no local import here? attachment' ? wizard seems a very generic name, I think you should use something more specific to what you do.
#135ff could you explain those lines? To me it seems we leave stuff in the database there that we don't want
#363 comment
#377 this text seems quite misleading. How about 'Add existing document/
$470 ir.attachment.
Further I don't see where you do any refcount. How do you take care that if attachment A is linked to records R1, R2 and R3, A stays if I delete R1 and R2, but will be deleted when I delete R3?
And how do you deal with attachments being only visible to people who have read permissions on the document given in res_model/res_id? I think you'll have to override that to also take the other linked records into account.
For usability, I'd also add a function field that combines res_model and res_id to a reference field.