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

[IMP] hr_expense: usability improvements #35400

Conversation

sht-odoo
Copy link
Contributor

@sht-odoo sht-odoo commented Aug 2, 2019

task - https://www.odoo.com/web?#id=2040887&action=333&active_id=131&model=project.task&view_type=form&menu_id=4720

pad - https://pad.odoo.com/p/r.a4335d455e929d48a75746eb6a62411d

For better user experience, there should be a 'UPLOAD' button on hr.expense
through which user can directly upload a single or multiple documents and
according to the number of documents, blank expense record with attached
document should be generated. These records should be in 'draft' state.
By this commit, this improvement has been achieved.

@C3POdoo C3POdoo added the RD research & development, internal work label Aug 2, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Aug 2, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 4bc3daf to 9ed3540 Compare August 2, 2019 10:52
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 2, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 9ed3540 to 2366b3c Compare August 6, 2019 13:46
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 6, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 2366b3c to 66fac0b Compare August 7, 2019 10:00
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 7, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 66fac0b to 8439cc6 Compare August 8, 2019 08:56
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 8, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 8439cc6 to 16b6eb7 Compare August 9, 2019 06:32
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 9, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 16b6eb7 to 4f58d3a Compare August 9, 2019 14:02
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 9, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 4f58d3a to 32ae0da Compare August 12, 2019 05:58
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Aug 12, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 32ae0da to 80cd2a2 Compare August 12, 2019 06:01
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Aug 12, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 80cd2a2 to d56e555 Compare August 12, 2019 12:08
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 12, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from d56e555 to 762f051 Compare August 12, 2019 13:31
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Aug 12, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Aug 12, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from 762f051 to e851d8d Compare August 13, 2019 12:27
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 13, 2019
Copy link
Contributor

@tivisse tivisse left a comment

Choose a reason for hiding this comment

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

Small comments. Could you adapt please ?

Thanks.

@@ -156,6 +156,42 @@ def _onchange_product_uom_id(self):
if self.product_id and self.product_uom_id.category_id != self.product_id.uom_id.category_id:
raise UserError(_('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.'))

def create_expense_from_attachments(self, attachment_ids=[]):
Copy link
Contributor

Choose a reason for hiding this comment

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

1/ Did you consider the security ? You have a public method to create attachments from an arbitrary list of ids.
2/ You should never use a mutable object as a method parameter. See: https://www.tutorialdocs.com/article/9-worst-python-practices.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tivisse
For point 1: I have put a condition, in that I have checked res_id and res_model values. If condition will be true then only 'create' will execute and records will be created.
For point 2: changes are done !

var qweb = core.qweb;
var DocumentUploadMixin = {

start: function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you adapt the code to:

  • Match the odoo guidelines
  • Match the linter requirements

Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done !

});

odoo.define('hr_expense.expenses.tree', function (require) {
"use strict";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be split into 2 .js files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done !

@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from e851d8d to e7a8907 Compare August 14, 2019 05:17
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 14, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from e7a8907 to ccba1f2 Compare August 14, 2019 10:17
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Aug 14, 2019
@sht-odoo sht-odoo force-pushed the master-hr_expense-usability-improvement-sht branch from ccba1f2 to 041b3f6 Compare August 14, 2019 10:40
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Aug 14, 2019
For better user experience, there should be a 'UPLOAD' button on'hr.expense'
through which user can directly upload a single or multiple documents and
according to the number of documents, blank expense record with attached
document should be generated. These records should be in 'draft' state.

TaskID: 2040887
@tivisse tivisse force-pushed the master-hr_expense-usability-improvement-sht branch from 041b3f6 to 86dc991 Compare August 16, 2019 15:01
@tivisse
Copy link
Contributor

tivisse commented Aug 16, 2019

@robodoo r+

@robodoo robodoo added r+ 👌 CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 16, 2019
robodoo pushed a commit that referenced this pull request Aug 16, 2019
For better user experience, there should be a 'UPLOAD' button on'hr.expense'
through which user can directly upload a single or multiple documents and
according to the number of documents, blank expense record with attached
document should be generated. These records should be in 'draft' state.

TaskID: 2040887

closes #35400

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
@robodoo
Copy link
Contributor

robodoo commented Aug 16, 2019

Merged at bf347e7, thanks!

@robodoo robodoo closed this Aug 16, 2019
@tivisse tivisse deleted the master-hr_expense-usability-improvement-sht branch August 19, 2019 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants