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

[15.0][ADD] purchase_order_update_planned_date #59

Open
wants to merge 2 commits into
base: 15.0
Choose a base branch
from

Conversation

IriaAlonso
Copy link

  • modify the “date_planned” field when confirming --> new_date_planned = date_planned + (date_approve - date_order)
  • “scheduled_date” field will take the new value of "planned_date"
    imagen
    imagen

@dalonsod

Comment on lines 16 to 17
for picking in order.picking_ids:
picking.write({'scheduled_date':new_date_planned})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really needed? In other words, if this code is removed, pickings scheduled_date are not updated?

Copy link
Author

Choose a reason for hiding this comment

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

no, scheduled_date takes the value of planned_date before updating it

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, could you investigate in purchase_stock addon in which situations scheduled_date is originally set depending on planned_date?

Copy link
Author

Choose a reason for hiding this comment

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

Function _prepare_stock_move_vals returns values to create a stock.move record. Among them is date (which would be scheduled_date) which takes the value of date_planned.
https://github.com/odoo/odoo/blob/15.0/addons/purchase_stock/models/purchase.py#L533

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look a this:

https://github.com/odoo/odoo/blob/3a28e5b0adbb36bdb1155a6854cdfbe4e7f9b187/addons/stock/models/stock_picking.py#L549

Picking scheduled_date is based on moves date field. And date for moves actually depends on order planned_date. So if we update date_planned before the order is confirmed (in this implementation we make this after confirmation), this could be enough (when confirm operation is made, date_planned is already the desired one at this moment, so moves are created at the first time with the right date and we don't need to update schedule_date for picking, because is actually updated at this point). Is that possible or is it complicated? I don't really know

@IriaAlonso IriaAlonso force-pushed the 15.0-add-ctm_purchase_order_update_planned_date branch from e52f67e to 5455977 Compare November 29, 2024 07:14
@IriaAlonso
Copy link
Author

@dalonsod can you test it?

…tion

Some fixes:
- Original code only update main date_planned (order header,
  not in lines).
- Date Planned was updated before PO confirmation, and we need it after
  approval (which is the moment before e.g. picking creation).
@dalonsod
Copy link
Contributor

Tested and still didn't work... I've made some changes, take a look at them, test them and ,then, we'll talk about this

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