-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [3546][ADD] stock_lot_suffix
- Loading branch information
Showing
19 changed files
with
737 additions
and
0 deletions.
There are no files selected for viewing
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_lot_suffix |
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,57 @@ | ||
================ | ||
Stock Lot Suffix | ||
================ | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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-qrtl%2Faxls--custom-lightgray.png?logo=github | ||
:target: https://github.com/qrtl/axls-custom/tree/16.0/stock_lot_suffix | ||
:alt: qrtl/axls-custom | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module provides the functionality to add suffixes to the display name of lots/serials. | ||
|
||
Suffixes are added to lots/serials created from purchase receipts with following conditions: | ||
|
||
- Purchase order has the channel_category set. | ||
- Purchase order line has an analytic account with lot suffix. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/qrtl/axls-custom/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/qrtl/axls-custom/issues/new?body=module:%20stock_lot_suffix%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 | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is part of the `qrtl/axls-custom <https://github.com/qrtl/axls-custom/tree/16.0/stock_lot_suffix>`_ project on GitHub. | ||
|
||
You are welcome to 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,18 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Stock Lot Suffix", | ||
"version": "16.0.1.0.0", | ||
"author": "Quartile Limited", | ||
"website": "https://www.quartile.co", | ||
"category": "Inventory", | ||
"license": "AGPL-3", | ||
"depends": ["purchase_stock", "analytic_mixin_analytic_account"], | ||
"data": [ | ||
"views/account_analytic_account_views.xml", | ||
"views/stock_lot_views.xml", | ||
"views/purchase_order_views.xml", | ||
"views/res_partner_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,92 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_lot_suffix | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-07-14 09:37+0000\n" | ||
"PO-Revision-Date: 2023-07-14 09:37+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_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "分析" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model,name:stock_lot_suffix.model_account_analytic_account | ||
msgid "Analytic Account" | ||
msgstr "分析勘定" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__analytic_account_names | ||
msgid "Analytic Account Names" | ||
msgstr "分析勘定名" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__analytic_account_ids | ||
msgid "Analytic Accounts" | ||
msgstr "分析勘定" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_account_analytic_account__lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_stock_lot__lot_suffix | ||
msgid "Lot Suffix" | ||
msgstr "ロットサフィックス" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "分析分配検索" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "分析精度" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,help:stock_lot_suffix.field_purchase_order__analytic_account_ids | ||
msgid "Analytic accounts computed from analytic distribution." | ||
msgstr "分析分配に指定した分析勘定" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_purchase_order__channel_category | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_res_partner__channel_category | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_res_users__channel_category | ||
#: model:ir.model.fields,field_description:stock_lot_suffix.field_stock_lot__channel_category | ||
msgid "Channel Category" | ||
msgstr "チャネルカテゴリ" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model.fields,help:stock_lot_suffix.field_purchase_order__analytic_account_names | ||
msgid "" | ||
"Comma-separated analytic account names, in case it is useful to be included " | ||
"in the exported data." | ||
msgstr "" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model,name:stock_lot_suffix.model_res_partner | ||
msgid "Contact" | ||
msgstr "連絡先" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model,name:stock_lot_suffix.model_stock_lot | ||
msgid "Lot/Serial" | ||
msgstr "ロット/シリアル" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model,name:stock_lot_suffix.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "購買オーダ" | ||
|
||
#. module: stock_lot_suffix | ||
#: model:ir.model,name:stock_lot_suffix.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,5 @@ | ||
from . import account_analytic_account | ||
from . import purchase_order | ||
from . import res_partner | ||
from . import stock_lot | ||
from . import stock_move_line |
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,10 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountAnalyticAccount(models.Model): | ||
_inherit = "account.analytic.account" | ||
|
||
lot_suffix = fields.Char() |
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 (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_name = "purchase.order" | ||
_inherit = ["purchase.order", "analytic.mixin"] | ||
|
||
channel_category = fields.Char() | ||
|
||
@api.onchange("partner_id") | ||
def _onchange_partner_id(self): | ||
if self.partner_id: | ||
self.channel_category = self.partner_id.channel_category |
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,10 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
channel_category = fields.Char() |
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 StockLot(models.Model): | ||
_inherit = "stock.lot" | ||
|
||
channel_category = fields.Char() | ||
lot_suffix = fields.Char() | ||
|
||
def name_get(self): | ||
name_list = super().name_get() | ||
new_name_list = [] | ||
for name in name_list: | ||
rec = self.browse(name[0]) | ||
new_name = name[1] | ||
if rec.lot_suffix: | ||
new_name += "-" + rec.lot_suffix | ||
if rec.channel_category: | ||
new_name += "-" + rec.channel_category | ||
new_name_list.append((name[0], new_name)) | ||
return new_name_list |
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,25 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
_inherit = "stock.move.line" | ||
|
||
def _action_done(self): | ||
res = super()._action_done() | ||
for ml in self: | ||
if not ml.lot_id: | ||
continue | ||
vals = {} | ||
purchase_line = ml.move_id.purchase_line_id | ||
vals["channel_category"] = purchase_line.order_id.channel_category | ||
# We assume that there is only one analytic account with lot_suffix if any. | ||
analytic_account = purchase_line.analytic_account_ids.filtered( | ||
lambda x: x.lot_suffix | ||
) | ||
if analytic_account: | ||
vals["lot_suffix"] = analytic_account[0].lot_suffix | ||
ml.lot_id.write(vals) | ||
return res |
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 @@ | ||
This module provides the functionality to add suffixes to the display name of lots/serials. | ||
|
||
Suffixes are added to lots/serials created from purchase receipts with following conditions: | ||
|
||
- Purchase order has the channel_category set. | ||
- Purchase order line has an analytic account with lot suffix. |
Oops, something went wrong.