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

[FIX] delivery: update carrier also on delivery #72859

Closed
wants to merge 1 commit into from

Conversation

agr-odoo
Copy link
Contributor

Create a sale order, add a product and shipping line
Confirm
Update shipping cost changing carrier
Save

Carrier on picking is not updated with the change

opw-2496008

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Create a sale order, add a product and shipping line
Confirm
Update shipping cost changing carrier
Save

Carrier on picking is not updated with the change

opw-2496008
@agr-odoo
Copy link
Contributor Author

@nle-odoo

@robodoo
Copy link
Contributor

robodoo commented Jun 28, 2021

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Jun 28, 2021
Copy link
Contributor

@nle-odoo nle-odoo left a comment

Choose a reason for hiding this comment

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

I'm not sure this is possible functionally, but could you not do and finish a picking for a sale order with a carrier, then add another sale order line that will create another picking?

Then this would update the picking that is already done, but maybe this is not supported (from the code, it seems like changing the carrier would delete the sale.order.line is_delivery and add a new one, so it seems we would have only one delivery cost on the sale order).

Also I'm a little afraid about access right, stock picking needs:

access_stock_picking_user,stock.picking user,model_stock_picking,stock.group_stock_user,1,1,1,1
access_stock_picking_manager,stock.picking manager,model_stock_picking,stock.group_stock_manager,1,1,1,1

and if I have rules that create pickings, in the JIT the picking is created in sudo:

    245         for company_id, moves_values in moves_values_by_company.items():
    246             # create the move as SUPERUSER because the current user may not have the rights to do it (mto product launched by a sale for example)
    247             moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(moves_values)
    248             # Since action_confirm launch following procurement_group we should activate it.
--> 249             moves._action_confirm()

so I'm not sure if the change will work if you are not a stock.group_stock_user and it might need a sudo somewhere

@agr-odoo
Copy link
Contributor Author

agr-odoo commented Jul 2, 2021

I'm not sure this is possible functionally, but could you not do and finish a picking for a sale order with a carrier, then add another sale order line that will create another picking?

Then this would update the picking that is already done, but maybe this is not supported (from the code, it seems like changing the carrier would delete the sale.order.line is_delivery and add a new one, so it seems we would have only one delivery cost on the sale order).

Indeed it seems a non supported operation as after marking as done the picking I'm free to change the shipping line in the sale order.

Also I'm a little afraid about access right, stock picking needs:

access_stock_picking_user,stock.picking user,model_stock_picking,stock.group_stock_user,1,1,1,1
access_stock_picking_manager,stock.picking manager,model_stock_picking,stock.group_stock_manager,1,1,1,1

and if I have rules that create pickings, in the JIT the picking is created in sudo:

    245         for company_id, moves_values in moves_values_by_company.items():
    246             # create the move as SUPERUSER because the current user may not have the rights to do it (mto product launched by a sale for example)
    247             moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(moves_values)
    248             # Since action_confirm launch following procurement_group we should activate it.
--> 249             moves._action_confirm()

so I'm not sure if the change will work if you are not a stock.group_stock_user and it might need a sudo somewhere

I tested with User sales access and no Inventory access: it works as expected (weird that in this case I can modify the related picking but I cannot see the transfer record because of other missing read perms)

@nle-odoo
Copy link
Contributor

nle-odoo commented Jul 2, 2021

I tested with User sales access and no Inventory access: it works as expected (weird that in this case I can modify the related picking but I cannot see the transfer record because of other missing read perms)

ah yes, it seems a sales->"own document" user has edit/unlink/create right to all pickings of current company, so at least there should not be an access issue:

2021-07-02-164935_928x1021_scrot

robodoo delegate+

@agr-odoo
Copy link
Contributor Author

agr-odoo commented Jul 2, 2021

robodoo r+

robodoo pushed a commit that referenced this pull request Jul 2, 2021
Create a sale order, add a product and shipping line
Confirm
Update shipping cost changing carrier
Save

Carrier on picking is not updated with the change

opw-2496008

closes #72859

Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
@robodoo robodoo closed this Jul 2, 2021
@robodoo robodoo temporarily deployed to merge July 2, 2021 17:02 Inactive
@wtaferner
Copy link
Contributor

@nle-odoo
At least you know some of the functionality and you are right that this is nothing I want to see as a stable fix...why?
There was even a functionality to create a delivery sale order line based on the picking...not sure if it was overseen during some upgrade (even if I never liked that it was default behavior).
Anyway, it should definitely not change a carrier of a done picking (never).

@fw-bot
Copy link
Contributor

fw-bot commented Jul 6, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

3 similar comments
@fw-bot
Copy link
Contributor

fw-bot commented Jul 7, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

@fw-bot
Copy link
Contributor

fw-bot commented Jul 8, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

@fw-bot
Copy link
Contributor

fw-bot commented Jul 9, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

@fw-bot
Copy link
Contributor

fw-bot commented Jul 10, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

2 similar comments
@fw-bot
Copy link
Contributor

fw-bot commented Jul 11, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

@fw-bot
Copy link
Contributor

fw-bot commented Jul 12, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

@fw-bot
Copy link
Contributor

fw-bot commented Jul 14, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #73176, #73179, #73182, #73184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants