Merge lp://staging/~akretion-team/project-service/project-service-base-sale-project into lp://staging/~project-core-editors/project-service/trunk

Proposed by Sébastien BEAU - http://www.akretion.com
Status: Merged
Merged at revision: 32
Proposed branch: lp://staging/~akretion-team/project-service/project-service-base-sale-project
Merge into: lp://staging/~project-core-editors/project-service/trunk
Diff against target: 272 lines (+241/-0)
6 files modified
sale_project_base/__init__.py (+26/-0)
sale_project_base/__openerp__.py (+43/-0)
sale_project_base/i18n/sale_project_base.po (+38/-0)
sale_project_base/project.py (+37/-0)
sale_project_base/sale.py (+69/-0)
sale_project_base/sale_view.xml (+28/-0)
To merge this branch: bzr merge lp://staging/~akretion-team/project-service/project-service-base-sale-project
Reviewer Review Type Date Requested Status
Daniel Reis lgtm, no test Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+211960@code.staging.launchpad.net

Description of the change

Hi,
We are cleanning and improving our OpenERP, so we plan to contribute everything here !
Let's start with some basic module
Here it's just a base module in order to link correctly a project and a sale order and also to create a project from a sale order.
No big thing, it's an base module that can be usefull in many case

Thanks for your review

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Sébastien, some remarks from a quick scan:

- Why do you need to declare a new field 'true_project_id' instead of using existing 'project_id'?
- You can put auto_install to True so that if sale and project are installed, this module is automatically installed.
- A similar module that glues sale and stock is called sale_stock. Maybe you can call yours sale_project.

Thanks for the contribution.

Regards.

review: Needs Information (code review)
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi Pedro

In fact this module is not a glue it more a base module for our modules (they will be contributed). But we think other project can need it so it why I push it here right now.

This module just add basic but usefull link between order and project and give the possibility to create a project from the sale order. I am not sure that it's a good idea to install it by default, I think it's better to install it only if it's needed. This is why I call it base_sale_project because it should be use as dependency of other module.

Regarding the field "project_id". In our case we need to have a real link between the sale order and the project. As "project_id" is already used for adding a link with... analytic.account :'(. We need to have a field that point on the "project.project" we don't found a better name than "true_project_id". The best will to clean addons code... and replace "project_id" by "analytic_account_id"

Thanks for your feedback

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Yeah, you're right about project_id relation with analytic account instead of the project.

About names and so on, it's a matter of taste, so I'm not going to object.

I have checked code and seems OK, so I give my approval.

What is what we expect next?

Regards.

review: Approve (code review)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

Thanks for the contribution!

Generating Projects from Sales Orders is a possible workflow.
But generating Tasks from Sales orders is also a valid workflow.
So I don't think it's a good idea to have it "autoinstall"ed.

I agree with Pedro on the two other issues:
- "base_*" modules are usually core functionality related; how about "sale_project_base"?
- I also find that "true_project_id" is not very intuitive. How about something like "related_project_id" or "sale_project_id"?

Nitpicks:
L66: s/posibility/possibility
L182: methods intended to be called by a button tend to be called "action_*". I suggest renaming this to "action_create_project()".
L188: I believe the context==None control can be safely removed here

Another suggestion (could be a later improvement):
- It would be nice for the create button to return an action, so that it opens the created Project after the button is clicked; like the Issue's "Create Task" button (standard in v6, ported to v7 in a project-service module).

review: Needs Information
38. By Sébastien BEAU - http://www.akretion.com

[REF] change module name, rename method linked to the button, remove useless context is None

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

@Daniel
I did the change, the name sale_project_base seem perfect for me.

For the field name, we should found something that contrast with the native "project_id" to avoid confusion. Developper that read the code should be alarmed by the name of the field.

Maybe "real_project_id"? What do you think?

note : related_project_id is great also. Pedro which one do you prefers?

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I think related_project_id can be intuitive enough and not a shocking name.

Daniel suggestions are good for me too.

Regards.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

IMHO real_project_id and true_project id looks the same.
For us keeping true_project_id would make migration easier...
I also think "true_project_id" carries enough "subversive meta information" to make it clear that if a foreign key points to an analytic account and not to a project, may be it was not a good idea to call it "project_id".

Thoughts?

Revision history for this message
Daniel Reis (dreis-pt) wrote :

If you're already using the module, changing a field name is rather painful, and it probably isn't worth the effort. So, no objections there.

It would also be nice to add the i18n/.po file, but I won't pick on that.

review: Approve (lgtm, no test)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

PS: Raphael, having a "project_id" field pointing at a Analytic Account is the kind of thing that bring emotion to OpenERP ;-)

39. By Sébastien BEAU - http://www.akretion.com

[REF] rename true_project_id into related_project_id

40. By Sébastien BEAU - http://www.akretion.com

[IMP] add translation file

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

I talk with Raph.
Even if we have to migrate our work, the later we will do the change the more painful it will be so let's rename it!
I also add the .po file

Thanks for your feedback

Just one question what is the best name for the onchange method?
- onchange_my_field
- on_my_field_change
-....

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I use to call it onchange_fieldname: compact and indicating the field name.

Regards.

41. By Sébastien BEAU - http://www.akretion.com

[REF] rename onchange and pass the context

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Yes is seem to be the best option, let's update my code

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches