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

[MIG] crm_action module from v8 to v9 #119

Closed
wants to merge 14 commits into from
Closed

Conversation

atularvind
Copy link

Migrated code of crm_action from v8 to v9

  • Added test file.
  • Improved openerp.py file
  • Changed view files

@oca-clabot
Copy link

Hey @atularvind, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: http://odoo-community.org/page/website.cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

@atularvind
Copy link
Author

@oca-clabot I have already signed the CLA and sent on the CLA email address.
Let me know if need to resend.

Thanks!

@pedrobaeza pedrobaeza mentioned this pull request Oct 20, 2016
22 tasks
code = fields.Char(
string='Lead Number', required=True, default="/", readonly=True)
code = fields.Char(string='Lead Number', required=True, default="/",
readonly=True)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

It' just my personal opinion, but I prefer the former formatting.
In general, either we like or dislike the formatting style, we should avoid editing lines just to change to another also valid formatting choice.

@dreispt
Copy link
Sponsor Member

dreispt commented Oct 20, 2016

It would have been best to have a PR per module.

Copy link
Sponsor Member

@dreispt dreispt left a comment

Choose a reason for hiding this comment

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

@atularvind Can you check the lint log: https://travis-ci.org/OCA/crm/jobs/169148076#L328
You can ignore the wrong-tabs-instead-of-spaces on XML files if you like, but there at least two messages that need fixing.

@atularvind
Copy link
Author

@dreispt Yes, I have reverted the migrated code for the crm_lead_code from this branch, will submit it in another PR. Now the travis-ci & runbot should go well.

@dreispt
Copy link
Sponsor Member

dreispt commented Oct 20, 2016

I don't understand: why did you revert those changes?

@atularvind
Copy link
Author

I wanted to submit one module per PR, and crm_lead_code was failing on the runbot. It needed changes in post_init_hook.

@dreispt
Copy link
Sponsor Member

dreispt commented Oct 21, 2016

IMO no problem to submit both now. I just added that to keep in mind for future PRs.

@atularvind
Copy link
Author

Already submitted #120 .

Copy link
Sponsor Member

@dreispt dreispt left a comment

Choose a reason for hiding this comment

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

One small comment, plus can you check the Lint warnings seen here?: https://travis-ci.org/OCA/crm/jobs/169159500#L330
At least the duplicate-xml-record-id and file-not-used warnings.

'version': '8.0.1.1.0',
'author': 'Savoir-faire Linux,Odoo Community Association (OCA)',
'version': '9.0.1.1.0',
'author': 'Savoir-faire Linux,Odoo Community Association (OCA),AtulArvind',
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

These are the original authors. Keep the original ones unless significant original changes have been made.

self.actions_count = len(self.action_ids)

actions_count = fields.Integer(compute='count_actions')
actions_count = fields.Integer(compute='_compute_count_actions')
Copy link
Member

Choose a reason for hiding this comment

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

The standard name, now that you take the time to rename the method, would be _compute_actions_count.

@@ -26,10 +26,10 @@
class CrmLead(models.Model):
_inherit = 'crm.lead'

def count_actions(self):
def _compute_count_actions(self):
self.actions_count = len(self.action_ids)
Copy link
Member

Choose a reason for hiding this comment

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

This lacks @api.multi and a loop over self.

@@ -32,14 +32,15 @@ Known issues / Roadmap
Credits
=======

Module developed and tested with Odoo version 8.0
Module developed and tested with Odoo version 9.0
Copy link
Member

Choose a reason for hiding this comment

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

This text is not needed.

!python {model: crm.lead} : |
lead_rec = self.browse(cr, uid, ref('test_crm_lead'))
lead_rec._compute_count_actions()
lead_rec.button_actions()
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for providing tests!

However these should be written directly with Python. Sooner or later the YAML support will be dropped.

I will not block this however, because better YAML tests than nothing, but change it if you can please.

'Date', required=True, default=fields.Date.context_today)
user_id = fields.Many2one(
'res.users', string='User', required=True,
default=lambda self: self.env.user)
Copy link
Member

Choose a reason for hiding this comment

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

Put field definitions above methods.

If you need a method defined, then use a lambda as you do here, or the method name in places where the ORM allows it.

@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Copy link
Member

Choose a reason for hiding this comment

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

Please update these awful license headers and put the shorter ones if you don't mind.

@rafaelbn rafaelbn added this to the 9.0 milestone May 11, 2017
@rafaelbn
Copy link
Member

Hi @atularvind , thanks for this migration. Are you going to answer comments from @dreispt and @yajo please? Let us know. Thanks!

@pedrobaeza
Copy link
Member

Superseeded by #140

@pedrobaeza pedrobaeza closed this May 17, 2017
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

6 participants