Skip to content

[MIG] website_sale module migration script - #676

Merged
pedrobaeza merged 3 commits into
OCA:9.0from
Tecnativa:9.0-mig-website_sale
Nov 25, 2016
Merged

[MIG] website_sale module migration script#676
pedrobaeza merged 3 commits into
OCA:9.0from
Tecnativa:9.0-mig-website_sale

Conversation

@cubells

@cubells cubells commented Nov 24, 2016

Copy link
Copy Markdown
Member
  • Created openupgrade_analysis_work.txt
  • Updated module coverage document

@Tecnativa

 * Created openupgrade_analysis_work.txt
 * Updated module coverage document
# Nothing to do

website_sale / res.partner / last_website_so_id (many2one) : NEW relation: sale.order
# Nothing to do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can try to deduce this looking for a sales order that comes from website from this partner.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A possible solution.

|website_rating_project_issue | |
+-----------------------------------+-----------------------------------+
|website_sale | |
|website_sale | Nothing to do |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be Done



def set_last_sale_on_partner(env):
partners = env['res.partner'].search([])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is going to be awfully slow. You can use an SQL to make this:

UPDATE res_partner rp
SET last_website_so_id = so.id
FROM sale_order so
WHERE so.id = (
   SELECT max(id) FROM sale_order
   WHERE partner_id = rp.id
)
AND rp.last_website_so_id IS NULL;

Note that website_order_line is a one2many field that behaves the same of normal order_line (so all sales orders are website applicable).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But how can I know which sales are normal sale and which sales are web sales?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok. I read your message now.

@pedrobaeza
pedrobaeza merged commit c46b602 into OCA:9.0 Nov 25, 2016
@pedrobaeza
pedrobaeza deleted the 9.0-mig-website_sale branch November 25, 2016 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants