-
-
Notifications
You must be signed in to change notification settings - Fork 456
[19.0][MIG] crm_phonecall: migration to 19.0 #712
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
base: 19.0
Are you sure you want to change the base?
Conversation
* crm_phonecall module (OCA#131) This module is the part extracted from Odoo v8 crm module from Odoo that allows to record phone calls. As it has been stripped off from Odoo v9, we add again the feature via this module. Migration scripts are also included to upgrade a v8 database via OpenUpgrade and don't lose your history. * [MIG] crm_phone_call: Migrated to 10.0 - FIX: Correct some lint errors * [MIG] crm_phone_call: Migrated to 10.0
…reated from phonecall2phonecall wizard.
Currently translated at 100.0% (150 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/es/
Currently translated at 86.0% (129 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/de/
…ve_id is not correct
Currently translated at 92.7% (139 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/de/
Currently translated at 98.0% (147 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/de/
Currently translated at 27.3% (41 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/hr/
Currently translated at 41.3% (62 of 150 strings) Translation: crm-12.0/crm-12.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_phonecall/hr/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: crm-13.0/crm-13.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-13-0/crm-13-0-crm_phonecall/
…bally from crm settings.
…change name to all groups for consistancy.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: crm-13.0/crm-13.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-13-0/crm-13-0-crm_phonecall/
Currently translated at 100.0% (161 of 161 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/it/
Currently translated at 100.0% (161 of 161 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/es/
Currently translated at 100.0% (155 of 155 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/it/
Currently translated at 100.0% (155 of 155 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/es/
Currently translated at 100.0% (154 of 154 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/es_AR/
Currently translated at 100.0% (154 of 154 strings) Translation: crm-16.0/crm-16.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_phonecall/it/
Currently translated at 100.0% (153 of 153 strings) Translation: crm-17.0/crm-17.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-17-0/crm-17-0-crm_phonecall/it/
Currently translated at 100.0% (153 of 153 strings) Translation: crm-17.0/crm-17.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-17-0/crm-17-0-crm_phonecall/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: crm-18.0/crm-18.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_phonecall/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: crm-18.0/crm-18.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_phonecall/
Currently translated at 99.3% (152 of 153 strings) Translation: crm-18.0/crm-18.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_phonecall/es/
Currently translated at 99.3% (152 of 153 strings) Translation: crm-18.0/crm-18.0-crm_phonecall Translate-URL: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_phonecall/es/
dad99bb to
d0ec288
Compare
d0ec288 to
b5cae86
Compare
|
The precommit command fails because it does not seem to be up to date with the change in v19.0 of the "user_ids" attribute of the base model "ir.filters". This attribute has changed compared to v18.0, where it was "user_id". Here is the commit where the change can be seen: odoo/odoo@414e55c |
rrebollo
left a comment
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.
Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! I've provided a few suggestions for your consideration—feel free to address them as you see fit.
| for lead in self: | ||
| lead.phonecall_count = self.env["crm.phonecall"].search_count( | ||
| [("opportunity_id", "=", lead.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.
| for lead in self: | |
| lead.phonecall_count = self.env["crm.phonecall"].search_count( | |
| [("opportunity_id", "=", lead.id)] | |
| ) | |
| phonecall_data = self.env["crm.phonecall"]._read_group( | |
| domain=[("opportunity_id", "in", self.ids)], | |
| groupby=["opportunity_id"], | |
| aggregates=["opportunity_id:count"], | |
| ) | |
| mapped_data = {p[0].id: p[1] for p in phonecall_data} | |
| for lead in self: | |
| count = mapped_data.get(lead.id, 0) | |
| lead.phonecall_count = count |
Single query
| date_action_last = fields.Datetime(string="Last Action", readonly=True) | ||
| date_action_next = fields.Datetime(string="Next Action", readonly=True) | ||
| create_date = fields.Datetime(string="Creation Date", readonly=True) |
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.
| date_action_last = fields.Datetime(string="Last Action", readonly=True) | |
| date_action_next = fields.Datetime(string="Next Action", readonly=True) | |
| create_date = fields.Datetime(string="Creation Date", readonly=True) | |
| date_action_last = fields.Datetime(string="Last Action") | |
| date_action_next = fields.Datetime(string="Next Action") | |
| create_date = fields.Datetime(string="Creation Date") |
readonly=True makes impossible to import these fields. OCA migration guidelines invite us to consider to set the attribute at view level.
| "to Cancelled.", | ||
| ) | ||
| email_from = fields.Char(string="Email", help="These people will receive email.") | ||
| date_open = fields.Datetime(string="Opened", readonly=True) |
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.
| date_open = fields.Datetime(string="Opened", readonly=True) | |
| date_open = fields.Datetime(string="Opened") |
| selection=[("0", "Low"), ("1", "Normal"), ("2", "High")], | ||
| default="1", | ||
| ) | ||
| date_closed = fields.Datetime(string="Closed", readonly=True) |
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.
| date_closed = fields.Datetime(string="Closed", readonly=True) | |
| date_closed = fields.Datetime(string="Closed") |
| phonecall.write(values) | ||
| else: | ||
| phonecall.duration = 0.0 | ||
| phonecall_no_dates.write({"duration": 0.0}) |
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.
| phonecall_no_dates.write({"duration": 0.0}) | |
| phonecall_no_dates.duration = 0.0 |
ORM now has no problem assigning same val to a recordset
| values = call.get_values_schedule_another_phonecall(vals) | ||
| new_id = self.create(values) | ||
| if vals.get("action") == "log": | ||
| call.write({"state": "done"}) |
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.
| call.write({"state": "done"}) | |
| call.state = "done" |
| self.ensure_one() | ||
| opportunity = self.env["crm.lead"] | ||
| opportunity_id = opportunity.create(self._prepare_opportunity_vals()) | ||
| self.write({"opportunity_id": opportunity_id.id, "state": "done"}) |
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.
| self.write({"opportunity_id": opportunity_id.id, "state": "done"}) | |
| self.update({"opportunity_id": opportunity_id.id, "state": "done"}) |
| for partner in self: | ||
| partner.phonecall_count = self.env["crm.phonecall"].search_count( | ||
| [("partner_id", "=", partner.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.
Something similar to my suggestion in the crm.lead model could be done to make a single query.
| self.env.cr.execute( | ||
| """ | ||
| create or replace view %s as ( | ||
| %s | ||
| %s | ||
| )""", | ||
| (AsIs(self._table), AsIs(self._select()), AsIs(self._from())), | ||
| ) |
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.
can't be odoo.tools import SQL, Query used over here?
|
@eugenios73 could you review mine? #661 |
migration crm_phonecall from 18.0 to 19.0