Skip to content

Commit 6fa290b

Browse files
[ADD] stock_move_actual_date
This module adds actual date in picking and scrap and pass the value to stock move, stock move line and accounting date of SVL's journal entry. When a user makes the transfer for the products with "real time" inventory valuation, effective date in transfer couldn't be selected. And Accounting date for stock valuation journal entry will be the same with effective date. So, for the users who want to specify each transfer's actual accounting date needs to reset to draft manually and change accounting date. This module intends to get rid of this inconvenience by adding actual date in transfer and scrap and then pass to journal entry.
1 parent 81e6588 commit 6fa290b

26 files changed

+1137
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_move_actual_date

setup/stock_move_actual_date/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

stock_move_actual_date/README.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
======================
2+
Stock Move Actual Date
3+
======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:d70c1f46222bd6a5f01ae300908138b08df6c418a5dc4eb01168cd345ba95e59
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_move_actual_date
21+
:alt: OCA/stock-logistics-warehouse
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_move_actual_date
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds an Actual Date field to the stock picking, stock scrap, stock move, and stock move line models. This field allows users to record the actual date on which a stock transfer or stock scrap took place, in case the transaction in Odoo is processed after the fact.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Usage
39+
=====
40+
41+
Use this module's function in the following situations:
42+
43+
* If you are late in processing a transfer or scrap in Odoo and wish to record the transaction with the actual transfer date, fill in the Actual Date field in the picking or scrap form. The Actual Date of the picking or scrap is then propagated to its corresponding stock moves and stock move lines, and is also passed to the journal entry as the date.
44+
* You can also update the Actual Date of a completed picking or scrap if you belong to the Inventory Manager group. This operation updates the date of the related journal entries, re-proposing a new sequence to them as necessary.
45+
46+
Known issues / Roadmap
47+
======================
48+
49+
Updating the Actual Date of a completed receipt picking for a foreign currency purchase does not trigger a recalculation of the amounts in the associated journal entries, even if the currency rate for the new date differs.
50+
51+
For the Actual Date of existing stock move and stock move line records created before this module was installed, the user's timezone will not be considered, and only the date part from the 'date' field in the UTC timezone will be assigned.
52+
53+
Bug Tracker
54+
===========
55+
56+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
57+
In case of trouble, please check there if your issue has already been reported.
58+
If you spotted it first, help us to smash it by providing a detailed and welcomed
59+
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_move_actual_date%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
60+
61+
Do not contact contributors directly about support or help with technical issues.
62+
63+
Credits
64+
=======
65+
66+
Authors
67+
~~~~~~~
68+
69+
* Quartile
70+
71+
Contributors
72+
~~~~~~~~~~~~
73+
74+
* `Quartile <https://www.quartile.co>`__:
75+
76+
* Aung Ko Ko Lin
77+
* Yoshi Tashiro
78+
79+
Maintainers
80+
~~~~~~~~~~~
81+
82+
This module is maintained by the OCA.
83+
84+
.. image:: https://odoo-community.org/logo.png
85+
:alt: Odoo Community Association
86+
:target: https://odoo-community.org
87+
88+
OCA, or the Odoo Community Association, is a nonprofit organization whose
89+
mission is to support the collaborative development of Odoo features and
90+
promote its widespread use.
91+
92+
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_move_actual_date>`_ project on GitHub.
93+
94+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

stock_move_actual_date/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import pre_init_hook
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Stock Move Actual Date",
5+
"version": "16.0.1.0.0",
6+
"author": "Quartile, Odoo Community Association (OCA)",
7+
"website": "https://github.com/OCA/stock-logistics-warehouse",
8+
"category": "Stock",
9+
"license": "AGPL-3",
10+
"depends": ["stock_account"],
11+
"data": [
12+
"views/stock_move_line_views.xml",
13+
"views/stock_move_views.xml",
14+
"views/stock_picking_views.xml",
15+
"views/stock_scrap_views.xml",
16+
],
17+
"pre_init_hook": "pre_init_hook",
18+
"installable": True,
19+
}

stock_move_actual_date/hooks.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2024 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo.tools.sql import column_exists
5+
6+
7+
def pre_init_hook(cr):
8+
if not column_exists(cr, "stock_move", "actual_date"):
9+
cr.execute(
10+
"""
11+
ALTER TABLE stock_move
12+
ADD COLUMN actual_date DATE;
13+
UPDATE stock_move
14+
SET actual_date = DATE(date);
15+
"""
16+
)
17+
cr.execute(
18+
"""
19+
ALTER TABLE stock_move_line
20+
ADD COLUMN actual_date DATE;
21+
UPDATE stock_move_line
22+
SET actual_date = DATE(date);
23+
"""
24+
)

stock_move_actual_date/i18n/ja.po

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * stock_picking_accounting_date
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2023-05-18 04:34+0000\n"
10+
"PO-Revision-Date: 2023-05-18 04:34+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: stock_picking_accounting_date
19+
#: model:ir.model.fields,field_description:stock_picking_accounting_date.field_stock_picking__accounting_date
20+
msgid "Accounting Date"
21+
msgstr "会計日"
22+
23+
#. module: stock_picking_accounting_date
24+
#: model:ir.model.fields,help:stock_picking_accounting_date.field_stock_picking__accounting_date
25+
msgid "Accounting date for stock valuation journal entry."
26+
msgstr "在庫評価仕訳の会計日"
27+
28+
#. module: stock_picking_accounting_date
29+
#: model:ir.model.fields,field_description:stock_picking_accounting_date.field_stock_picking__show_accounting_date
30+
msgid "Show Accounting Date"
31+
msgstr "会計日を表示"
32+
33+
#. module: stock_picking_accounting_date
34+
#: model:ir.model,name:stock_picking_accounting_date.model_stock_move
35+
msgid "Stock Move"
36+
msgstr "在庫移動"
37+
38+
#. module: stock_picking_accounting_date
39+
#: model:ir.model,name:stock_picking_accounting_date.model_stock_picking
40+
msgid "Transfer"
41+
msgstr "運送"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from . import account_move
2+
from . import actual_date_mixin
3+
from . import res_currency
4+
from . import stock_move
5+
from . import stock_move_line
6+
from . import stock_picking
7+
from . import stock_scrap
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2024 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class AccountMove(models.Model):
8+
_inherit = "account.move"
9+
10+
def _must_check_constrains_date_sequence(self):
11+
if self.env.context.get("skip_date_sequence_check"):
12+
return False
13+
return super()._must_check_constrains_date_sequence()
14+
15+
def _update_accounting_date(self):
16+
self.button_draft()
17+
for move in self:
18+
move = move.with_context(skip_date_sequence_check=True)
19+
move.date = move.stock_move_id.actual_date
20+
if not move._sequence_matches_date():
21+
move.name = False
22+
self.action_post()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2024 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ActualDateMixin(models.AbstractModel):
8+
_name = "actual.date.mixin"
9+
10+
actual_date = fields.Date(
11+
tracking=True,
12+
help="If set, the value is propagated "
13+
"to the related journal entries as the date.",
14+
)
15+
is_editable_actual_date = fields.Boolean(
16+
compute="_compute_is_editable_actual_date", string="Is Editable"
17+
)
18+
19+
def _compute_is_editable_actual_date(self):
20+
for rec in self:
21+
rec.is_editable_actual_date = False
22+
if rec.state not in ["done", "cancel"] or self.env.user.has_group(
23+
"stock.group_stock_manager"
24+
):
25+
rec.is_editable_actual_date = True

0 commit comments

Comments
 (0)