Commit Graph

66 Commits

Author SHA1 Message Date
Christophe Simonis ea659cbd87 [MERGE] forward port of branch 7.0 up to 16a545b 2015-06-24 12:34:03 +02:00
Nicolas Lempereur 1942522969 [FIX] base: update File Content for binary field
To distinguish two ir.attachment 'File Content', we base it on the file
size (this I imagine is for efficiency).

This is done by setting bin_size in the context. Doing this, the
returned db_datas field will be the file size of the converted to base64
content (if no filestore).

But this size is returned in string format, so "get_nice_size" (in
openerp/osv/fields.py) which gets this size calculates the length of the
string. e.g: if the size is '2142' get_nice_size will return 4.

This fix solves this by converting the string to an integer, thus
unifying it with the filestore case (where we use os.path.getsize which
return an integer).

Also, the field presenting the issue (FieldBinaryFile) has been changed
so it is always updated even if the size is the same (as it was already
done by 3632949 for FieldBinaryImage widget).

closes #7223
opw-643071
2015-06-23 15:20:33 +02:00
Christophe Simonis 59d82e6fe7 [MERGE] forward port of branch 7.0 up to 5042d91 2015-04-07 13:36:01 +02:00
Denis Ledoux eaad70daac [FIX] ir_attachment: upload of attachment for non-employees
This rev. is related to eb9113c04d

if a model or a resource id is not defined on an attachment
restrict access to employees only if the creator
of this attachment is not the current user.

So non-employees can access their attachments without
models/resource id, which includes attachment of
discussions threads.

Fixes #4309
Closes #4310
2015-04-03 12:44:44 +02:00
Christophe Simonis 4a3c4713e9 [MERGE] forward port of branch 7.0 up to 209ce6f 2015-03-09 11:24:32 +01:00
Stefan Rijnhart 4781deb5b6 [FIX] base: Replace unreliable reference count through ORM by SQL
When the ORM is cleaning up related attachments upon record deletion, the
search() method hides the attachment of the record that is being deleted.
If the same file is used exactly once in another attachment, the reference
count will be 1 and the file will be deleted.
2015-03-04 11:23:44 +01:00
Denis Ledoux 77500e54ec [MERGE] forward port of branch 7.0 up to eb9113c 2014-10-02 15:34:02 +02:00
Denis Ledoux eb9113c04d [FIX] ir_attachment: restrict access to orphan attachments to employees 2014-10-02 15:17:48 +02:00
Denis Ledoux e447a46ec8 [MERGE] forward port of branch 7.0 up to 33e0910 2014-09-09 18:02:30 +02:00
Denis Ledoux 1e374b4ad7 [FIX] ir_attachment: ignore if model uninstalled
if the model of an attachement no longer exists (the according module have been uninstalled, for instance), ignore the security check
2014-09-08 10:51:46 +02:00
Christophe Simonis ada9724655 [MERGE] forward port of branch 7.0 up to 3509e15 2014-08-28 16:12:55 +02:00
Denis Ledoux 72d3697fbc [FIX] security: externals should be able to read attachements
without having the rights to read ir.config_parameter
2014-08-26 12:55:48 +02:00
Thibault Delavallée ab5c23079a [MERGE] Sync with trunk, solved conflicts.
bzr revid: tde@openerp.com-20140116091716-zk1n5ots94i65io5
2014-01-16 10:17:16 +01:00
Denis Ledoux 05aab83eb1 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9743 revid:qdp-launchpad@openerp.com-20140108160719-9i8xhrat49cn9l5e
bzr revid: chs@openerp.com-20140107141524-xzz39a2ym66swr0t
bzr revid: chs@openerp.com-20140107172248-zic9mqg0rigy2czb
bzr revid: chs@openerp.com-20140108160418-ph17jgy5hlejj9hr
bzr revid: dle@openerp.com-20140108171400-8r0fwv3wi36w2im0
2014-01-08 18:14:00 +01:00
Thibault Delavallée 7a72d858cb [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20140103151324-jk0u8vmrxxomy5vx
2014-01-03 16:13:24 +01:00
Denis Ledoux 20be322c45 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9684 rev-id: dle@openerp.com-20131209145652-3g9rgnfz1w8k0whw
bzr revid: chs@openerp.com-20131202105848-33gcz1715w370rve
bzr revid: dle@openerp.com-20131204150643-is3y0b9n8enh3yql
bzr revid: chs@openerp.com-20131206152726-pirikn7v8pev90ic
bzr revid: dle@openerp.com-20131206162437-b9niay99mirk44qm
bzr revid: tde@openerp.com-20131209102019-kjeg0rx2au1d5e5v
bzr revid: dle@openerp.com-20131209155721-589zihxx8jmvlpvp
2013-12-09 16:57:21 +01:00
Denis Ledoux fb90e7d572 [FIX]ir_attachement: not self.pool.get(model) instead of model not in self.pool
bzr revid: dle@openerp.com-20131206173602-no831oxc6m1kf6lu
2013-12-06 18:36:02 +01:00
Denis Ledoux 4669f05406 [FIX] ir_attachement: search, if the model of the ir_attachement has been removed, the search ignore the attachement.
bzr revid: dle@openerp.com-20131206162314-vjpgtag8qhkl1jhk
2013-12-06 17:23:14 +01:00
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Denis Ledoux 6fd552c3ce [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5139 rev-id: dle@openerp.com-20131121132305-qjlclgz5v9tze1fr
bzr revid: odo@openerp.com-20131120102545-2tlp031yib6viz35
bzr revid: chs@openerp.com-20131120161708-c8sbom592moukwxw
bzr revid: dle@openerp.com-20131121155457-lh7fzouk2upeiu16
2013-11-21 16:54:57 +01:00
Xavier Morel 8e78b40e6a [MERGE] from trunk
bzr revid: xmo@openerp.com-20131115132553-9eqxggih8be63i36
2013-11-15 14:25:53 +01:00
Denis Ledoux b7988bcc5a [FIX] ir, ir_attachement: traceback if try to create attachement without res_id, caused by check access rights trying to check if the user had the right to read the object with a res_id 0
bzr revid: dle@openerp.com-20131119140246-r8dd7h0di4aigjss
2013-11-19 15:02:46 +01:00
Denis Ledoux 0cf57bdee2 [MERGE] Forward-port of latest saas-1 bugfixes, up to rev. 8800 rev-id: dle@openerp.com-20131031162241-goga1hsvwgyqigzd
bzr revid: chs@openerp.com-20131031142325-vo84hk5co2e2phg0
bzr revid: dle@openerp.com-20131031143133-wfus2hag57e73by2
bzr revid: dle@openerp.com-20131031162928-8gpom1ralccy07uc
2013-10-31 17:29:28 +01:00
Christophe Simonis 82211b1ac2 [MERGE] forward port of branch 7.0 up to revid 5113 launchpad_translations_on_behalf_of_openerp-20131031054724-b9dbttdcrl9eccwr
bzr revid: chs@openerp.com-20131025103657-pbnqhw11mygyi5jn
bzr revid: chs@openerp.com-20131031142125-7bm00z2jpccf3v6f
2013-10-31 15:21:25 +01:00
Martin Trigaux e2d6786bc1 [FIX] ir_attachment: fix security issues on ir_attachment
check: verify the permissions even when no ids are passed (skipped permission checking for create)
create: verify has the write access on the related model (instead of create, was not checked anyway)
function field: execute the write in fnct_inv as superuser (was impossible to have creation without write access)

bzr revid: mat@openerp.com-20131030084408-t857gl7d4lkbrj5p
2013-10-30 09:44:08 +01:00
Martin Trigaux 15905e78c5 [FIX] ir_attachment: fix security issues on ir_attachment
check: verify the permissions even when no ids are passed (skipped permission checking for create)
create: verify has the write access on the related model (instead of create, was not checked anyway)
function field: execute the write in fnct_inv as superuser (was impossible to have creation without write access)

bzr revid: mat@openerp.com-20131029171420-x87wu7ph8ej7mtro
2013-10-29 18:14:20 +01:00
Thibault Delavallée 97f164ba99 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20131028163325-2hpks3hp23zop40n
2013-10-28 17:33:25 +01:00
Olivier Dony 77caeeeba5 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5101 rev-id: odo@openerp.com-20131016105812-844cd9xljvkjwtm3
bzr revid: odo@openerp.com-20131016110621-36vvlpn8dgsabyt1
2013-10-16 13:06:21 +02:00
Olivier Dony 06b2ce213c [FIX] document: overridden ORM methods need to respect API idiosyncrasies, otherwise check() calls may fail
bzr revid: odo@openerp.com-20131016105812-844cd9xljvkjwtm3
2013-10-16 12:58:12 +02:00
Olivier Dony 54f740960e [MERGE] Forward-port of latest saas-1 bugfixes, up to rev. 4912 rev-id: odo@openerp.com-20131016110621-36vvlpn8dgsabyt1
bzr revid: odo@openerp.com-20131016111800-jjybreg62bwz61zn
2013-10-16 13:18:00 +02:00
Fabien Pinckaers 29326cd993 [IMP] Add file='...' on <field> tags + [FIX] forced noupdate
bzr revid: fp@openerp.com-20130922093113-80p3pig45qbm7lsn
2013-09-22 11:31:13 +02:00
Denis Ledoux a3f57cd43b [FIX]ir_attachement: if res_id = 0, allow to read if allowed to read model
bzr revid: dle@openerp.com-20130724130936-u1payhg18hcssj0z
2013-07-24 15:09:36 +02:00
Thibault Delavallée ac791818e0 [MERGE] [CHERRYPICK] Backport of revision 4879 of saas-1 branch.
[FIX] ir_attachment: in check, values could coutain a
False res_model; no need to check self.pool[False], obviously. We consider void attachments
as being accessible, because no related document exists.

lp bug: https://launchpad.net/bugs/1171457 fixed

bzr revid: tde@openerp.com-20130530142608-jgu1y7175q8hjkt5
2013-05-30 16:26:08 +02:00
Thibault Delavallée 98bce97f27 [FIX] ir_attachment: in check, values could coutain a
False res_model; no need to check self.pool[False], obviously. We consider void attachments
as being accessible, because no related document exists.

Hint: backport me in 7.0

lp bug: https://launchpad.net/bugs/1171457 fixed

bzr revid: tde@openerp.com-20130530142015-rgpf7jw4x34yhoet
2013-05-30 16:20:15 +02:00
Raphael Collet 05851d21ba [MERGE] from trunk
bzr revid: rco@openerp.com-20130411073017-x6e4h8xbvmy3ofdw
2013-04-11 09:30:17 +02:00
Raphael Collet 09be864f1d [IMP] replace all tests like 'registry.get(X)' by 'X in registry' where X is non static
bzr revid: rco@openerp.com-20130329140723-dnrl02saky570xg0
2013-03-29 15:07:23 +01:00
Olivier Dony 3cb01bd596 [FIX] ir.attachment: fix drunken commit 4814
bzr revid: odo@openerp.com-20130131145348-00yngxmjfy2eforj
2013-01-31 15:53:48 +01:00
Antony Lesuisse 8ef1f06c0f [FIX] ir_attachment missing logger
bzr revid: al@openerp.com-20130131144525-msftyc0hn257g9t8
2013-01-31 15:45:25 +01:00
Fabien Pinckaers c095e2d340 [FIX] document management, file do not exists
bzr revid: fp@tinyerp.com-20130114174355-ygieirm80j9ftixx
2013-01-14 18:43:55 +01:00
Antony Lesuisse c353392294 [FIX] ir_attachment filestore read on windows
lp bug: https://launchpad.net/bugs/1131272 fixed

bzr revid: al@openerp.com-20130227221943-izxnxulg0picimez
2013-02-27 23:19:43 +01:00
Antony Lesuisse 0ed151708a last fix
bzr revid: al@openerp.com-20121220023721-oy7y4czmf3tvmyzl
2012-12-20 03:37:21 +01:00
Antony Lesuisse 549c011893 [MERGE] turnk
bzr revid: al@openerp.com-20121220020708-ioiaoz58ncgw5wg7
2012-12-20 03:07:08 +01:00
Cecile Tonglet 5f0070dcb6 [FIX] Remove unused imports and fix some imports that doesn't use the new namespace
bzr revid: cto@openerp.com-20121217143029-e9ki4ftwihq7pdme
2012-12-17 15:30:29 +01:00
Antony Lesuisse fde832955a add file_size
bzr revid: al@openerp.com-20121217011601-utt2a0zweaq2c0bt
2012-12-17 02:16:01 +01:00
Antony Lesuisse 70aa2c995a filestore testcase and fix bugs
bzr revid: al@openerp.com-20121216190317-xoz0jij2cfk0c2zk
2012-12-16 20:03:17 +01:00
Antony Lesuisse 2569587c90 Simplify openerp testing, deprecated redondant test declaration, we feed all
tests.* modules to unittest2.TestLoader.loadTestsFromModule(module)

bzr revid: al@openerp.com-20121216173856-euntlfi80uzutkp0
2012-12-16 18:38:56 +01:00
Antony Lesuisse 807c949030 minor fixes
bzr revid: al@openerp.com-20121216122555-frwadjd247zidw7o
2012-12-16 13:25:55 +01:00
Vo Minh Thu 509a084e79 [IMP] use the openerp namespace.
bzr revid: vmt@openerp.com-20121210152723-mv4dykfu6ip1991h
2012-12-10 16:27:23 +01:00
Antony Lesuisse e11aa2d37b [MERGE] trunk
bzr revid: al@openerp.com-20121208173012-upufsxqur04r0242
2012-12-08 18:30:12 +01:00
Olivier Dony 7f5ad72429 [MERGE] Forward-port 6.1 bugfixes up to rev. 4307
rev.4307 = rev-id launchpad_translations_on_behalf_of_openerp-20121125065030-g5if5pybr61la4yj

bzr revid: odo@openerp.com-20121126160320-t2suuik6lhk6wl0x
bzr revid: odo@openerp.com-20121126161836-mv8yymzgbnmif4ve
bzr revid: odo@openerp.com-20121126162023-ejvsapwouyudw6c6
bzr revid: odo@openerp.com-20121126181527-d4yx15372bis77qj
2012-11-26 19:15:27 +01:00