-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
[8.0] Refactor lettermgmt #87
Conversation
another great thing to add would be tests... |
@hbrunn Functional changes:
|
I'm need to make the module to extend the workflow. It will re-implement the 'created' and 'validated' states. I still don't completely understand the use case, though.. I mean, it didn't have security groups, so any user was able to create or validate any letter. If it was only to track the letter prep states before sending, the same could be achived by just using internal notes or messages. Even so, it seems to be a very company-specific case. I think it's very possible no one will use it anymore (and ever). Should I do it the same? I don't mind.. I just don't like the idea of useless modules. |
@max3903 I'd like to hear your thoughts too |
what's the state of this PR? Can we review? |
(asking because I'm in the process of adding a 'done' state and support for needaction, and it would make sense to get your refactoring merged first of course) |
|
||
# Migrate 'type' to 'type_id' | ||
cr.execute("""ALTER TABLE res_letter | ||
RENAME COLUMN type to type_id""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should borrow openupgrade's code for renaming a model here: https://github.com/OCA/openupgradelib/blob/master/openupgradelib/openupgrade.py#L328 to get links from other models (mostly) right after you renamed letter.class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Well, I kinda stop working on it because of the low attention it got. I'll take a look at openupgrade's code, as you suggested, and make the changes later this week. |
that's probably because of the work in progress label - I changed this to needs review to invite other reviewers |
""" Go from cancelled state to draf state """ | ||
self.write({'state': 'draft'}) | ||
self.delete_workflow() | ||
self.create_workflow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this model doesn't define a workflow (in the sense of odoo's workflows), so why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time of this PR, I was just starting to learn odoo. I guess I've just copied this from another module's code, and it doesn't apply here at all.
I need help with migration. I'm not happy with how it is right now. I'm not sure if it works properly either. |
@ivantodorovich just from looking at the code, the migration seems okay. What is it you're not happy about? |
This right here:
openupgrade renames the table instead of copying all the records from the old table into the new table. Anyway, considering this module's popularity, I guess no one will ever care about that, as long as it works. |
what error message do you get here? And did you prepare your test database accordingly? |
Do you need any functional help here @ivantodorovich @hbrunn ? |
I'm sorry for not responding earlier. I'll test again the migration code on a clean database and see if I can improve it. |
This PR is hard to review, but I can trust @hbrunn if he says this is OK |
@ivantodorovich, can you squash a bit the commits? @hbrunn, any comments? |
Done. Squashed into a single commit. |
my comment is let's merge as soon as @ivantodorovich has fixed the last travis nags: https://travis-ci.org/OCA/crm/jobs/168795594#L314 |
Updated py headers. Added headers to xml files. Reordered res_letter.py lines to make them more readable. Improved help strings on a few fields. Added default values for sender/recipient. Simplified views. Unified 'in' and 'out' letter views. Major view improvements. Changed class to category_ids (Many2many_tags). Changed type to type_id (for consistency). Added migration script. Added view's 'oe_view_nocontent_create' helps for types, categories, channels and folders. Add security group to hide/show reassignments and parent/child. Increment sequence only after the record is saved, not before. Simplify and improve workflow. Known Issue: 'created' and 'validated' states are reverted to 'draft'. Added search filter 'Pending' and set by default (shows letters that haven't arrived to destination). Make 'recipient' and 'sender' fields required in the model, instead of required only in the view. Add tests
Done, sorry about that! |
Thanks for your efforts! |
As discussed in #83
Feel free to comment and make suggestions as I work.
TODO:
Migrate field class to class_idmigrated to category_ids.Add seccurity group to show/hide reassignmentsAdd seccurity group to show/hide partner / childIncrement sequence only after the record is saved, not before.Simplify and improve state workflow.Support current "advanced" workflow in a separate module.wont support it in this prAdd default filter 'Pending' and search fields to list views.Add tests