Commit Graph

49 Commits

Author SHA1 Message Date
Martin Trigaux 2758aaa6f8 [IMP] models: sanitize error messages in import
Revert 83282f2d for a cleaner sanitizing earlier in the generation of the error
message.

If the import is failing, the error message contains the value that is
problematic. Escape this value in case it contains '%'
2015-07-01 17:04:48 +02:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Christophe Simonis fd4fd35e32 [MERGE] forward port of branch saas-5 up to e4cb520 2014-07-30 20:52:14 +02:00
Denis Ledoux 88c022dfc8 [MERGE] forward port of branch 7.0 up to bbb8d8f25a 2014-07-29 11:42:10 +02:00
Christophe Combelles 740d5c6cd3 [FIX] Fix broken translation cache for absent translation of 'false' 2014-07-07 17:29:11 +03:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Christophe Simonis 500fea28b7 [MERGE] forward port of branch saas-2 up to revid 5007 chs@openerp.com-20140206110220-myn57cryam1y4k9v
bzr revid: chs@openerp.com-20140206110423-qe4h5ip2dg6dm7ph
2014-02-06 12:04:23 +01:00
Martin Trigaux 7950914c69 [IMP] ir_fields: no need to sanitize the _str_to_html as it is already done in the _symbol_set of html fields. This avoids doing twice the sanitization.
bzr revid: mat@openerp.com-20140206094628-umx2rfb9rcim7v82
2014-02-06 10:46:28 +01:00
Mohammed Shekha (OpenERP) 15813479f5 [FIX]Fixed the issue of html field import fails, because of no converter found for str to html.
bzr revid: msh@openerp.com-20140203120525-ui117od6lpksm1bq
2014-02-03 17:35:25 +05:30
Xavier Morel 58ff276887 [FIX] pillow-compatible import
bzr revid: xmo@openerp.com-20140114124843-zpg2qzua90uq1pxu
2014-01-14 13:48:43 +01:00
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Cecile Tonglet 83f6778446 [FIX] Import on model ir.translation was broken because of a missing context
bzr revid: cto@openerp.com-20131112132747-bajrgbwlp0m3z92s
2013-11-12 14:27:47 +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
Xavier Morel cd31b4af4d [IMP] move field conversion around
ir.fields architecture turns out not to be a very good or simple fit,
especially as different widgets/fields need different granularity of
customizations. Having objects dedicated to each field type/widget
makes things simpler as it allows a conversion pipeline which can be
plugged into at any point.

bzr revid: xmo@openerp.com-20131007091556-03azc2mdhcb7kmwo
2013-10-07 11:15:56 +02:00
Xavier Morel 6507bdd82c [IMP] turns out PIL includes MIME mapping
bzr revid: xmo@openerp.com-20131004095023-dudohbovvinqz8om
2013-10-04 11:50:23 +02:00
Fabien Pinckaers 1db512092f [IMP] events
bzr revid: fp@openerp.com-20130928164336-6exrohfc2ek4d2y5
2013-09-28 18:43:36 +02:00
Xavier Morel 3295203a66 [IMP] have ir_fields_converter.to_field accept either a type or a string-representing-a-type as input
bzr revid: xmo@openerp.com-20130927142856-lnrboxzgpd3wzqem
2013-09-27 16:28:56 +02:00
Olivier Dony d6a9d0c05d [FIX] ir.fields.converter: fields.reference values were not importable because the (trivial) converter was missing
bzr revid: odo@openerp.com-20130927142303-ykcjnxgdiuni3lnk
2013-09-27 16:23:03 +02:00
Xavier Morel e1f3f0566e [ADD] float field digits handling
bzr revid: xmo@openerp.com-20130927113424-lt23wpzs7px7k6mc
2013-09-27 13:34:24 +02:00
Xavier Morel 2707b17771 [IMP] add #verify PIL call, can't hurt
bzr revid: xmo@openerp.com-20130926134429-8uwav5lyck532eb2
2013-09-26 15:44:29 +02:00
Xavier Morel 789c0d8a6b [ADD] Conversions from field values to "html" content
> many2one --> mettre <br/> si multi-line, html escape le reste (ex:
> adresse sur un event, on a du mettre dans un <pre> mais ce n'est pas
> bien)

> text --> mettre <br/> si multi-line, html escape le reste (ex:
> description d'un produit, à droite)

> char --> normalement pas de multi-line

> fields.binary --> t-field on image field ne semble pas fonctionner
> en écriture (la photo d'une fiche produit)

(validates that the binary field's content is image data by opening it
with PIL, then generates an <img> tag)

TODO:

> fields.float --> utiliser le digits pour formatter les decimals
> correctement (ex: prix d'un produit, à deux décimales)

> On aura aussi besoin d'un widget="currency", un peu comme dans la
> vue form du client web.

bzr revid: xmo@openerp.com-20130926133850-ab14h241q878jbom
2013-09-26 15:38:50 +02: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
Xavier Morel 18f885b10f [FIX] recursive conversion of o2ms in import
added new test cases from gkr

bzr revid: xmo@openerp.com-20121106084206-1cckepflh9h4g1yv
2012-11-06 09:42:06 +01:00
Xavier Morel 10345423b1 [FIX] treat imported datetime as local to the context-provided or user's datetime
bzr revid: xmo@openerp.com-20121009085446-obfpn4c5r250zonc
2012-10-09 10:54:46 +02:00
Xavier Morel 35c0e73eb4 [FIX] m2m command in import
command helpers create a single command, still need the list around commands

and the tests would have caught it, if I'd run them...

bzr revid: xmo@openerp.com-20121009070934-7i1hxuzumdu8x1jy
2012-10-09 09:09:34 +02:00
Xavier Morel afee5b63ee [IMP] use readable relation helper to generate a '6' m2m command
bzr revid: xmo@openerp.com-20121008133311-ejaix536syks41oo
2012-10-08 15:33:11 +02:00
Xavier Morel 443b5b9767 [FIX] missing translation mark on exception message
bzr revid: xmo@openerp.com-20121008133116-da2n77kbk9evaa7g
2012-10-08 15:31:16 +02:00
Xavier Morel 12f4150195 [IMP] avoid reimplementing (ir.model.data).get_object_reference() by hand, caught by odo
bzr revid: xmo@openerp.com-20121008133006-zsjdvax07zsrjwm6
2012-10-08 15:30:06 +02:00
Xavier Morel 00c7d9f4c0 [FIX] incorrect views spec in relational fields 'more info' action, spotted by odo
bzr revid: xmo@openerp.com-20121008132054-y57mg2rhxg6hkx2s
2012-10-08 15:20:54 +02:00
Xavier Morel 53786034e3 [FIX] docstring typo for name of converter methods on ir_fields, following odo review
bzr revid: xmo@openerp.com-20121008131545-u5sdlolmmgr8db2y
2012-10-08 15:15:45 +02:00
Xavier Morel 350d365ba0 [IMP] remove docstring for cr, uid following odo review
bzr revid: xmo@openerp.com-20121008131407-5hnxkn17lycfoqzu
2012-10-08 15:14:07 +02:00
Xavier Morel 27f15d8af8 [IMP] 'more info' actions from relational fields conversion
link to ir.model.data if failing to link with database or external ids

bzr revid: xmo@openerp.com-20121004151753-wuyra1fjo31ur56g
2012-10-04 17:17:53 +02:00
Xavier Morel 67a9cf851c [IMP] use moreinfo key to provide more info as to what the boolean and date value should look like
bzr revid: xmo@openerp.com-20121004123237-p5ht1uozaobxn8b7
2012-10-04 14:32:37 +02:00
Xavier Morel e77fad774b [IMP] error messages for datetime error
bzr revid: xmo@openerp.com-20121004115822-54mzaeqi05h0p4ve
2012-10-04 13:58:22 +02:00
Xavier Morel b9b19f61ea [FIX] if a selection label is empty, return the value in a selection import message
bzr revid: xmo@openerp.com-20121003115949-sgsouhcmboascjbl
2012-10-03 13:59:49 +02:00
Xavier Morel aed20ca5d7 [FIX] conversion and validation of date and datetime field imports
bzr revid: xmo@openerp.com-20121001134330-za8hqctrghmw08i4
2012-10-01 15:43:30 +02:00
Xavier Morel 84332d8aad [FIX] type error when providing a non-integer for a default database id
bzr revid: xmo@openerp.com-20121001130530-yf6pzuxdi3s09tji
2012-10-01 15:05:30 +02:00
Xavier Morel 87af7a6365 [FIX] replace warnings capture by explicitly returning a list of warnings from converters
makes converter code noisier, but ultimately simpler without having access to dynamically scoped variables

bzr revid: xmo@openerp.com-20120927144341-j1dx3e0epf3i5ja6
2012-09-27 16:43:41 +02:00
Xavier Morel f39730e918 [FIX] make conversion errors for floats and integers more predictable
Python turns out to have changed the wording of the messages between 2.6 and 2.7

also, these messages need to be translatable *and* use the human-readable field name

bzr revid: xmo@openerp.com-20120927103452-cvgv3e8dsvcvnics
2012-09-27 12:34:52 +02:00
Xavier Morel e61dc50934 [IMP] convert empty import fields to False values without going through converters
simplifies the converter methods by avoiding redundant emptiness checks

bzr revid: xmo@openerp.com-20120925155915-82p2s6stpww37p5n
2012-09-25 17:59:15 +02:00
Xavier Morel d5c69fa87e [FIX] use lists instead of iterators in BaseModel._extract_records
* although it does use an explicit external index, it turns out the
  code is less complex

* the rewrapping of (many) iterators on top of one another ended up
  blowing Python's stack during ``next`` calls, which Python does
  *not* like

* added a 900-ish import test file to check for these things

bzr revid: xmo@openerp.com-20120925135955-oielhopegnefyctm
2012-09-25 15:59:55 +02:00
Xavier Morel e6c8f1739a [ADD] 'more info' action to m2o, o2m and m2m linking failures
bzr revid: xmo@openerp.com-20120925074256-18puerjbfo3om265
2012-09-25 09:42:56 +02:00
Xavier Morel f143902d1a [IMP] allow converters to add data to import messages, formalize message keys
bzr revid: xmo@openerp.com-20120924150417-c2y7g7vdsfz66363
2012-09-24 17:04:17 +02:00
Xavier Morel 449a86a51f [IMP] cache boolean and selection translations for the request (cursor) to avoid fetching them over and over again
bzr revid: xmo@openerp.com-20120924103257-1jgc3qhddzzi5c17
2012-09-24 12:32:57 +02:00
Xavier Morel a9bc82c46d [IMP] translation tests, translated acceptable values for boolean fields
bzr revid: xmo@openerp.com-20120920150443-l9lna4bnkta7n2o8
2012-09-20 17:04:43 +02:00
Xavier Morel fdba99aaeb [ADD] inline o2m LINK_TO (m2m-style)
bzr revid: xmo@openerp.com-20120920110914-hy2rtivhn9cs5wuc
2012-09-20 13:09:14 +02:00
Xavier Morel 8e841cd8f7 [FIX] non-linking o2m tests, corresponding code
bzr revid: xmo@openerp.com-20120920105612-03ifizt2iv08tdhz
2012-09-20 12:56:12 +02:00
Xavier Morel c9e0cfd64a [ADD] force linking to existing o2m being updated
bzr revid: xmo@openerp.com-20120920102545-30tkodb4s1dng5hp
2012-09-20 12:25:45 +02:00
Xavier Morel 9805c665c8 [ADD] big bit on new import: pretty much everything but o2m
bzr revid: xmo@openerp.com-20120919114047-w4paoim95oxr91zb
2012-09-19 13:40:47 +02:00