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

11.0 Migration partner_location_auto_create #443

Closed
wants to merge 8 commits into from
Closed

11.0 Migration partner_location_auto_create #443

wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 7, 2018

Migration of partner_location_auto_create

two improvement have been made:

  1. Installation hook to create custom locations for existing partners
    https://github.com/BT-kaberer/stock-logistics-warehouse/blob/11.0-mig-partner_location_auto_create/partner_location_auto_create/hooks.py#L9
  2. When creating contacts on a company they should inherit the parent's location

#343

@pedrobaeza pedrobaeza mentioned this pull request Jun 7, 2018
46 tasks
@pedrobaeza pedrobaeza added this to the 11.0 milestone Jun 7, 2018
@ghost
Copy link
Author

ghost commented Jun 20, 2018

Another improvement:
When creating contacts on a company they should inherit the parent's location

Copy link

@MeetKD MeetKD left a comment

Choose a reason for hiding this comment

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

Small changes !!

'license': 'AGPL-3',
'complexity': 'normal',
'images': [],
'website': 'http://www.savoirfairelinux.com',
Copy link

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

👍

'test': [],
'auto_install': False,
'installable': True,
}
Copy link

Choose a reason for hiding this comment

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

Remove empty key and flags.

Copy link
Author

Choose a reason for hiding this comment

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

👍

# © 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, SUPERUSER_ID
Copy link

Choose a reason for hiding this comment

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

Not sure if this is needed anymore. We have a sudo now.

Copy link
Author

Choose a reason for hiding this comment

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

It's needed to create a new Environment for the installation hook. Sudo does not help here

@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<openerp>

Copy link

Choose a reason for hiding this comment

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

No description provided.

Copy link
Author

Choose a reason for hiding this comment

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

👍

<button name="%(stock.action_location_form)d"
position="after">
<group>

Copy link

Choose a reason for hiding this comment

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

You can remove this extra space.

Copy link
Author

Choose a reason for hiding this comment

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

👍

<openerp>
<data>

<record id="view_partner_form" model="ir.ui.view" >
Copy link

Choose a reason for hiding this comment

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

replace for all openerp tag reference

Copy link
Author

Choose a reason for hiding this comment

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

👍




</data>
Copy link

Choose a reason for hiding this comment

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

Remove unnecessary space from xml files.

Copy link
Author

Choose a reason for hiding this comment

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

👍

Copy link
Sponsor Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Code review

##############################################################################
# © 2015 Savoir-faire Linux
# © 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

openerp => odoo

_inherit = 'res.config.settings'

default_customer_location = fields.Many2one(
related='company_id.default_customer_location')
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

readonly=True

default_customer_location = fields.Many2one(
related='company_id.default_customer_location')
default_supplier_location = fields.Many2one(
related='company_id.default_supplier_location')
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Same as above

##############################################################################
# © 2015 Savoir-faire Linux
# © 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api, _
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

openerp => odoo

location.unlink()
for partner in self:
for location in partner.location_ids:
moves = move_obj.search([
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

If you have locations with huge moves, this could be a bottleneck.
I would have used search_count() instead or search with a limit of 1 before the loop and create a dict with result grouping by location id and then iterating.

@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<openerp>
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

odoo

Copy link
Sponsor Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Code review

@rousseldenis
Copy link
Sponsor Contributor

@MeetKD Can you update your review ?

@rousseldenis
Copy link
Sponsor Contributor

@MeetKD

Copy link
Member

@tbaden tbaden left a comment

Choose a reason for hiding this comment

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

code review: lgtm

please squash your commits. I'll approve then

@rousseldenis
Copy link
Sponsor Contributor

@ghost due to inactivity, this will be closed soon.

@rousseldenis
Copy link
Sponsor Contributor

Closing this due to inactivity and user has been deleted.

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