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][ADD] stock_picking_po_preserve_date_diff #35

Open
wants to merge 1 commit into
base: 11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions stock_picking_po_preserve_date_diff/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
===================================
Set schedules date to stock picking
===================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fslv--purchase-lightgray.png?logo=github
:target: https://github.com/OCA/slv-purchase/tree/11.0/stock_picking_po_preserve_date_diff
:alt: OCA/slv-purchase
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/slv-purchase-11-0/slv-purchase-11-0-stock_picking_po_preserve_date_diff
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/slv-purchase&target_branch=11.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Modify scheduled date from stock picking to keep date difference from purchase order and purchase order lines

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/slv-purchase/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/slv-purchase/issues/new?body=module:%20stock_picking_po_preserve_date_diff%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Solvos

Contributors
~~~~~~~~~~~~

* Adrian Resua <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/slv-purchase <https://github.com/OCA/slv-purchase/tree/11.0/stock_picking_po_preserve_date_diff>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_picking_po_preserve_date_diff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions stock_picking_po_preserve_date_diff/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# © 2023 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
{
"name": "Set schedules date to stock picking",
"summary": """
Modify scheduled date from stock picking to keep date difference from purchase order and purchase order lines
""",
"author": "Solvos",
"license": "LGPL-3",
"version": "11.0.1.0.0",
"category": "Inventory/Purchase",
"website": "https://github.com/solvosci/slv-purchase",
"depends": ["purchase"],
"data": [
],
'installable': True,
}
1 change: 1 addition & 0 deletions stock_picking_po_preserve_date_diff/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_picking
19 changes: 19 additions & 0 deletions stock_picking_po_preserve_date_diff/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# © 2023 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html

from datetime import datetime
import pdb
from odoo import api, fields, models

class AccountAnalyticAccount(models.Model):
_inherit = "stock.picking"

@api.one
@api.depends('move_lines.date_expected')
def _compute_scheduled_date(self):
if self.purchase_id.date_order:
purchase_date_order = datetime.strptime(self.purchase_id.date_order, "%Y-%m-%d %H:%M:%S")
purchase_date_planned = datetime.strptime(self.purchase_id.date_planned, "%Y-%m-%d %H:%M:%S")
deltatime_difference = purchase_date_planned - purchase_date_order
today_day = datetime.strptime(fields.Datetime.now(), "%Y-%m-%d %H:%M:%S")
self.scheduled_date = (today_day + deltatime_difference).strftime("%Y-%m-%d %H:%M:%S")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Adrian Resua <[email protected]>
1 change: 1 addition & 0 deletions stock_picking_po_preserve_date_diff/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modify scheduled date from stock picking to keep date difference from purchase order and purchase order lines
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading