Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0][MIG] date_range #95

Closed
wants to merge 33 commits into from

Conversation

MiquelRForgeFlow
Copy link
Contributor

Standard migration.

lmignon and others added 30 commits September 30, 2019 11:37
* [ADD] Basic structure for the new date range module

* [IMP] Add a basic description into the README

* [IMP] Basic implementation

* [IMP] First working implementation

* [IMP] Improve datamodel

* [ADD] Add basic tests for date.range

* [PEP8]

* [PYLINT]

* [DEL] Remove unused code

* [IMP] Remove unsused dependencies into the JS

* [IMP] Better operator label for date range

* [DEL] Remove unused file

* [IMP] Better user experience by showing the select input only once empty

* [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters

* [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters

* [FIX]Try to fix tests that fails only on travis by using postgresql 9.4

* [FIX]Try with postgresql 9.2 since the daterange method has appeared in 9.2

* [IMP] Add a limitation into the module description to warm about the minimal version of postgresql to use

* [IMP]Add multi-company rules

* [IMP]Remove unused files

* [FIX] Add missing brackets into JS

* [FIX] Overlap detection when company_id is False

* [IMP] Add default order for date.range

* [IMP] Add date range generator

* [FIX] OE compatibility

* [FIX] Travis

* [IMP] Code cleanup and improves test coverage

* [FIX] Add missing dependency on 'web'

* [PYLINT] remove unused import

* [FIX] Add missing copyright

* [FIX] Limits are included into the range

* [IMP][date_range] Security

* [IMP] Improve module description

* [IMP] Spelling
* Improve 'name' for generator wizard

  ir.rule should be active by default
* Don't auto-add '-' after prefix when generating date ranges via wizard
* code fine tuning suggested by Sylvain Garancher
Currently translated at 89.1% (41 of 46 strings)

Translation: server-ux-11.0/server-ux-11.0-date_range
Translate-URL: https://translation.odoo-community.org/projects/server-ux-11-0/server-ux-11-0-date_range/ar/
If any module adds a required field on company, module fails. Executing it on
post_install, there's no problem.
Currently translated at 82.6% (38 of 46 strings)

Translation: server-ux-11.0/server-ux-11.0-date_range
Translate-URL: https://translation.odoo-community.org/projects/server-ux-11-0/server-ux-11-0-date_range/da/
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Currently translated at 100.0% (46 of 46 strings)

Translation: server-ux-12.0/server-ux-12.0-date_range
Translate-URL: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-date_range/it/
Currently translated at 100.0% (46 of 46 strings)

Translation: server-ux-12.0/server-ux-12.0-date_range
Translate-URL: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-date_range/pt/
@MiquelRForgeFlow
Copy link
Contributor Author

@lmignon These onchanges are not good to be replaced by a compute, because these onchanges are conditional. The computes in v13 only work when they are not conditional and always end filling the field. Moreover, the constrains already are a warranty.

I think this PR is ready as it is. Just test it functionally.

@astirpe
Copy link
Member

astirpe commented Oct 1, 2019

Error #95 (comment) still reproducible in Runbot.

It's caused by the call to method read_slice() that cannot be used anymore (it's now placed in a folder named "_deprecated"). See https://github.com/odoo/odoo/blob/saas-12.5/addons/web/static/src/js/_deprecated/data.js#L411

@MiquelRForgeFlow
Copy link
Contributor Author

MiquelRForgeFlow commented Oct 1, 2019

It's weird. In v12 the read_slice() was already in the _deprecated folder.

@astirpe
Copy link
Member

astirpe commented Oct 1, 2019

And I just noticed: when opening the web console of the browser, I get: Error while loading date_range.search_filters.

@MiquelRForgeFlow
Copy link
Contributor Author

MiquelRForgeFlow commented Oct 1, 2019

wip. help wanted for javascript thing.

@MiquelRForgeFlow MiquelRForgeFlow force-pushed the 13.0-mig-date_range branch 3 times, most recently from ec73b8d to 7f61b56 Compare October 2, 2019 20:39
@MiquelRForgeFlow
Copy link
Contributor Author

@lmignon finally converted the onchanges to computes 😉

Copy link
Sponsor Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments into the code....
Nevertheless the JS part seems to not work
image

date_range/models/date_range.py Outdated Show resolved Hide resolved
Comment on lines +52 to +58
// this._rpc({
// model: 'date.range',
// method: 'search_read',
// fields: ['name', 'date_start', 'date_end'],
// context: this.context,
// domain: ['type_id', '=', parseInt(type_id, 10)]]
// }).done(this.proxy('on_range_type_selected'));
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mreficent This code must be removed id it's no more needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this code expressly to indicate what should be the way to fix the javascript error, this code should replace the next two lines. I put commented instead because it's not correct yet.

Comment on lines +19 to +24
// this._rpc({
// model: 'date.range.type',
// method: 'search_read',
// fields: ['name'],
// context: this.context,
// }).done(this.proxy('add_date_range_types_operator'));
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mreficent This code must be removed id it's no more needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this code expressly to indicate what should be the way to fix the javascript error, this code should replace the next two lines. I put commented instead because it's not correct yet.

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mreficent Is this PR therefore still a WIP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's stated in #95 (comment).

date_range/tests/test_date_range.py Outdated Show resolved Hide resolved
date_range/tests/test_date_range_generator.py Outdated Show resolved Hide resolved
date_range/wizard/date_range_generator.py Outdated Show resolved Hide resolved
@lmignon
Copy link
Sponsor Contributor

lmignon commented Oct 18, 2019

@mreficent I've fixed the JS, rebased the branch on 13.0 and fixed pre-commit issues in #99. It was not possible to PR your branch with mine due to the rebase. Can I close this one? Everything is working now

@pedrobaeza
Copy link
Member

He is today on holidays, but I think there's no problem on that while you preserve his commit for proper attribution. We are all working in the same goal, which is having this migrated 😃

I dare to close it in advance.

@pedrobaeza pedrobaeza closed this Oct 18, 2019
@lmignon
Copy link
Sponsor Contributor

lmignon commented Oct 18, 2019

@pedrobaeza of course the commit history is preserved 😏 I close it.

@pedrobaeza
Copy link
Member

Yeah, I don't doubt about that coming from you. That's why I closed it directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet