-
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6071748
commit cba1f84
Showing
16 changed files
with
743 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_picking_accounting_date/odoo/addons/stock_picking_accounting_date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_picking_accounting_date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
============================= | ||
Stock Picking Accounting Date | ||
============================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_accounting_date | ||
:alt: OCA/stock-logistics-warehouse | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_picking_accounting_date | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/153/16.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds an accounting date in both stock pickings and stock moves. | ||
The accounting date from the picking is propagated to its corresponding stock move. | ||
If a picking doesn't specify an accounting date, the stock move's accounting date | ||
will be set to the 'Effective Date'. This value is then passed to the SVL's journal entry | ||
accounting date. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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/stock-logistics-warehouse/issues/new?body=module:%20stock_picking_accounting_date%0Aversion:%2016.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 | ||
~~~~~~~ | ||
|
||
* Quartile Limited | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Quartile <https://www.quartile.co>`__: | ||
|
||
* Aung Ko Ko Lin | ||
|
||
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/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_picking_accounting_date>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Stock Picking Accounting Date", | ||
"version": "16.0.1.0.0", | ||
"author": "Quartile Limited, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-warehouse", | ||
"category": "Stock", | ||
"license": "AGPL-3", | ||
"depends": ["stock_account"], | ||
"data": [ | ||
"views/stock_move_views.xml", | ||
"views/stock_picking_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_accounting_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-05-18 04:34+0000\n" | ||
"PO-Revision-Date: 2023-05-18 04:34+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_picking_accounting_date | ||
#: model:ir.model.fields,field_description:stock_picking_accounting_date.field_stock_picking__accounting_date | ||
msgid "Accounting Date" | ||
msgstr "会計日" | ||
|
||
#. module: stock_picking_accounting_date | ||
#: model:ir.model.fields,help:stock_picking_accounting_date.field_stock_picking__accounting_date | ||
msgid "Accounting date for stock valuation journal entry." | ||
msgstr "在庫評価仕訳の会計日" | ||
|
||
#. module: stock_picking_accounting_date | ||
#: model:ir.model.fields,field_description:stock_picking_accounting_date.field_stock_picking__show_accounting_date | ||
msgid "Show Accounting Date" | ||
msgstr "会計日を表示" | ||
|
||
#. module: stock_picking_accounting_date | ||
#: model:ir.model,name:stock_picking_accounting_date.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "在庫移動" | ||
|
||
#. module: stock_picking_accounting_date | ||
#: model:ir.model,name:stock_picking_accounting_date.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "運送" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import stock_picking | ||
from . import stock_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
accounting_date = fields.Date( | ||
compute="_compute_accounting_date", | ||
store=True, | ||
) | ||
|
||
@api.depends("date", "accounting_date") | ||
def _compute_accounting_date(self): | ||
for line in self: | ||
line.accounting_date = fields.Datetime.context_timestamp(self, line.date) | ||
if line.picking_id.accounting_date: | ||
line.accounting_date = line.picking_id.accounting_date | ||
|
||
def _prepare_account_move_vals( | ||
self, | ||
credit_account_id, | ||
debit_account_id, | ||
journal_id, | ||
qty, | ||
description, | ||
svl_id, | ||
cost, | ||
): | ||
am_vals = super(StockMove, self)._prepare_account_move_vals( | ||
credit_account_id, | ||
debit_account_id, | ||
journal_id, | ||
qty, | ||
description, | ||
svl_id, | ||
cost, | ||
) | ||
if self.accounting_date: | ||
am_vals.update({"date": self.accounting_date}) | ||
return am_vals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
accounting_date = fields.Date( | ||
states={"done": [("readonly", True)], "cancel": [("readonly", True)]}, | ||
help="Accounting date for stock valuation journal entry.", | ||
) | ||
show_accounting_date = fields.Boolean(compute="_compute_show_accounting_date") | ||
|
||
def _compute_show_accounting_date(self): | ||
for pick in self: | ||
pick.show_accounting_date = False | ||
if pick.picking_type_code not in ("incoming", "outgoing"): | ||
continue | ||
if pick.move_ids.with_company(pick.company_id).product_id.filtered( | ||
lambda x: x.detailed_type == "product" and x.valuation == "real_time" | ||
): | ||
pick.show_accounting_date = True | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* `Quartile <https://www.quartile.co>`__: | ||
|
||
* Aung Ko Ko Lin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This module adds an accounting date in both stock pickings and stock moves. | ||
The accounting date from the picking is propagated to its corresponding stock move. | ||
If a picking doesn't specify an accounting date, the stock move's accounting date | ||
will be set to the 'Effective Date'. This value is then passed to the SVL's journal entry | ||
accounting date. |
Oops, something went wrong.