Commit Graph
192 Commits
Author SHA1 Message Date
Cédric Krier 6b11460823 Fallback to model name as title
issue9596
review300381002
2020-10-04 00:35:23 +02:00
Cédric Krier e11a23deb2 Rationalize import path
We use absolute path when imported module is from a different context.
And we remove unnecessary __all__ definition.

issue9466
review323591002
2020-07-21 14:38:36 +02:00
Cédric Krier d7ed5f91f5 Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:54 +01:00
Cédric Krier 4920c59650 Allow to use dotted notation in Model.get_id
issue8890
review282481004
2020-01-20 22:18:27 +01:00
Sergi Almacellas Abellana 5f8639a982 Add missing end dot on translatable strings
issue8670
review252211037
2019-09-30 09:40:36 +02:00
Sebastien Marie ed470bada7 Skip the Function field without setter in Data.sync()
issue8478
review251711002
2019-07-17 00:55:17 +02:00
Cédric Krier 65c896b1f0 Do not fail on importing string tools if missing python-Levenshtein
python-Levenshtein is an optional dependency so trytond.tools.string_ should
not fail on import.

issue8040
2019-03-15 13:37:17 +01:00
Cédric Krier e2318257bb Allow to extend Field string and help
Those attributes are stored as StringPartitioned and each part creates its own
translation record. The translated strings are constructed by concatenation of
each translated part.

issue8040
review46731002
2019-03-15 13:01:11 +01:00
Cédric Krier 10e31bc311 Add Model.__names__ to retrieve model and field names
issue8159
review72431002
2019-03-15 12:27:44 +01:00
Cédric Krier 23a1288d32 Improve sync of data
- Enforce refresh session
- Remove write access for admin
- Use root to synchronize
- Do not fail if model does not exist anymore
- Remove from written values fields that do not exist anymore
- Rewrite fs_value to ensure normalized format

issue7950
review45971002
2019-03-15 11:11:33 +01:00
Cédric Krier c39858aac7 Allow to delete record from XML with noupdate
We set the db_id to None to avoid to link later to a different record.

issue7668
review50671002
2019-01-07 22:08:52 +01:00
Cédric Krier 55619becda Remove unused ModelFieldGroup
issue7944
review52571002
2018-12-30 00:19:25 +01:00
Cédric Krier 1738a4ec35 Add ir.message and use custom exceptions
issue3672
review35291002
2018-12-29 14:19:08 +01:00
Cédric Krier c7f5c54a83 Remove implicit fields names in ModelStorage.read
It is a bad practice to not explicit the fields to read. So we should not
support it.

issue7830
review54421002
2018-11-28 10:05:01 +01:00
Cédric Krier a97f889228 Fix get access against nullable active group
The group table is in a left join so group.active can be NULL for model/field
access without group. On such case the access values must still be selected.

issue7023
2018-10-31 20:21:04 +01:00
Xavier Codinas 8be4976700 Add active field
issue7023
review50411002
2018-10-30 16:31:42 +01:00
Cédric Krier 680af38018 Sort keys when dumping data
This ensure stability for future comparison.

issue7761
review45741002
2018-10-21 21:28:43 +02:00
Cédric Krier a6a7325f46 Remove deprecation warning
- remove invalid escape sequence
- use  read_file instead of read_fp
- use importlib instead of imp and __import__
- use callable instead of instance of collections.Callable
- fix silent file closing
- replace SafeConfigParser by ConfigParser
- replace decodestring by decodebytes
- replace encodestring by encodebytes

issue7666
issue7390
review53361004
2018-09-01 17:06:28 +02:00
Cédric Krier 4d779f27eb Remove migration before 3.0
issue6470
review52421002
2018-08-09 20:43:52 +02:00
Cédric Krier 7a2ce7905a Add __table_handler__ to ModelSQL
issue7581
review48531002
2018-07-24 22:01:08 +02:00
Cédric Krier d2a461390a Remove support for Python 2.7
issue7497
review53261002
2018-06-26 19:11:19 +02:00
Cédric Krier c244bdf422 Clean ir.model and ir.model.field once every models have been registered
The same model can be registered multiple times by one module so the cleaning
can only happen when the all the classes have been registered.

issue7500
review53271002
2018-06-11 23:18:28 +02:00
Cédric Krier 65659dcf30 Remove clean of ir_model_field in register
issue7500
review53271002
2018-06-11 23:17:54 +02:00
Sergi Almacellas Abellana bfb76a70ad Add deactivable mixin and ensure active field is present
issue4341
review38401002
2018-03-26 14:07:45 +02:00
Sergi Almacellas Abellana 514a38fbf2 Use field_description as field rec_name when available
issue7238
review40191002
2018-03-22 11:03:33 +01:00
Sergi Almacellas Abellana 6d39f13489 Add migration to register buttons on ir module
changeset 83757dc87808 moved the buttons from res to ir module but it missed
the migration of the model data to allow updates from previous databases

issue7186
review38031003
2018-03-02 14:21:17 +01:00
Sergi Almacellas Abellana ff2bded417 Ensure that all buttons are registered in ir.model.button
issue6389
review36621002
2018-03-01 11:59:23 +01:00
Sergi Almacellas Abellana 54f70e2971 Add depends on Button
issue6919
review40811002
2018-02-19 11:35:37 +01:00
Cédric Krier b197b6b13d Add cache for check_xml_record
This allows fast return when the checked model has no record in ir.model.data
which is the most common case. This allow to prevent to search for non
existing records.

issue7119
review37991002
2018-02-14 19:35:57 +01:00
Cédric Krier 6a90d3ad68 Use the target model name to check access right for many2many field
The attribute target contains the name of the field on the relation model and
not the name of the target model.

issue6856
review36701002
2017-10-21 10:44:11 +02:00
Cédric Krier 6b3551c834 Ensure rec_name is a char, text type
Model.default_get with 'default_rec_name' context relies on the fact that
rec_name is a string base field.

issue6630
review36501002
2017-07-26 23:43:00 +02:00
Cédric Krier 62826903c2 Raise KeyError instead of generic Exception
This is a more specific exception that allows better catch.

issue6409
review34891002
2017-04-01 10:38:51 +02:00
Cédric Krier a908e8cc74 Add MultiValueMixin and ValueMixin and remove Propery
issue2349
review23351002
2017-04-01 00:24:55 +02:00
Cédric Krier e7ff9ee619 Use compact separators to dump json
issue6373
review33991002
2017-03-23 22:51:36 +01:00
Cédric Krier 9758b4bf05 Convert generators from ModelButtonClick.register
As ModelView.button could consume multiple times the clicks list, the generator
of groupby must be converted in to list.

issue6319
review33881002
2017-03-08 10:22:13 +01:00
Cédric Krier cc89a96c35 Do not copy clicks of ModelButton
issue6228
review26061002
2017-02-02 12:08:20 +01:00
Cédric Krier f9c0457416 Remove support for simplejson
On Python 3, simplejson has a different behaviour than the stdlib json,
especially for dumping bytes.

issue6010
review33601002
2016-11-05 19:54:12 +01:00
Cédric Krier e843bd23c5 Add button rule
issue5944
review26791002
2016-10-26 09:44:09 +02:00
Cédric Krier 3ee721345d Remove IDENTIFIER regexp on ir.model and ir.model.field
This regexp has all the factors for ReDoS so it is safer to remove it even if
only administrators can create the records.

issue5743
review29481002
2016-09-06 09:03:11 +02:00
Cédric Krier 9601375f8a Always write the fs values when sync data
This prevent to keep out of sync, data that are Python equals but the
representation is different like float and integer.

issue5559
review27481003
2016-07-11 18:28:32 +02:00
Sergi Almacellas Abellana f22e4e077c Fix antipatern of create/write in loop
issue3516
review14931003
2016-06-09 17:32:17 +02:00
Cédric Krier f0235a101c Fix decoding test in global search
In Python3, str has no more a decode method but it is the bytes type which has it.
Bytes is a synonym for str in Python2, so we can use it for this test.

issue5593
review25121002
2016-06-03 00:02:38 +02:00
Cédric Krier 33d8f038d7 Add workflow graph on ir.model
issue5292
review15961002
2016-03-15 18:59:11 +01:00
Nicolas Évrard 2fef479575 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:51:57 +01:00
Cédric Krier c7829b15f7 Sync model data with only the filesystem values
It must not update the previous values as some field could have been removed.
Also there is no problem with module override because this button is called
during normal run and not the update module process, so the filesystem value
contains all the overridden values.

issue4992
review22451002
2015-10-01 17:09:14 +02:00
Cédric Krier 44dc331ced Use Constraint instance in ModelSQL._sql_constraints
issue4814
review15491002
2015-06-22 16:57:06 +02:00
Cédric Krier 318b8cac65 Use explicite comparison to Boolean in SQL queries
Not every database supports boolean expression.

issue4810
review17291002
2015-06-15 01:20:25 +02:00
Cédric Krier 611b96c5f0 Add is_instance_method tool compatible with Python3
issue3211
2015-03-18 23:34:55 +01:00
Cédric Krier 5cfde31ed2 Use bytes and bytearray for Binary
issue4637
review11091002
2015-03-16 19:28:34 +01:00
Cédric Krier d7db35c995 Fix selection_change_with
Initialize selection_change_with with en empty set. It must be a set to allow
later fields.depends to update it. The ModelAccess.check_relation must also
manage instance method.

issue4636
review14091002
2015-03-15 16:26:10 +01:00