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

[17.0][MIG] stock_landed_costs_currency: Migration to 17.0 #1672

Closed
wants to merge 10 commits into from
105 changes: 105 additions & 0 deletions stock_landed_costs_currency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
===========================
Stock Landed Costs Currency
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:26ca831a1a43e643c6848c916cecba8b09bde90428bf030aa3f12a3258b49e5a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_landed_costs_currency
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-17-0/stock-logistics-workflow-17-0-stock_landed_costs_currency
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=17.0
:alt: Try me on Runboat

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

This module allows user to add landed costs in different currencies to
cost of products

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Enable Multi-Currencies configuration
2. Go to your user settings.
3. Tick the box *Multi Currencies* in *Extra Rights*.

Usage
=====

To use this module, you need to:

# Go to *Inventory > Operations > Landed Costs* and choose the *Account
Journal* and the corresponding *Currency* # Add a cost line and set the
*Cost* column with the amount in that *Currency* # The amount in column
*Cost in Company Currency* will be automatically converted to Company's
currency by the exchange rate on the Date of Landed Cost # After
clicking "Validate", your products has been valued with amounts in a
consistent currency (which is Company's currency)

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_landed_costs_currency%0Aversion:%2017.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
-------

* Komit Consulting

Contributors
------------

- Duc, Dao Dong <[email protected]>
(https://komit-consulting.com)
- Pimolnat Suntian <[email protected]> (https://ecosoft.co.th)
- Jan Dziurzyński <[email protected]> (https://braintec.com)
- `APSL-Nagarro <https://apsl.tech>`__:

- Antoni Marroig <[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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/17.0/stock_landed_costs_currency>`_ 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_landed_costs_currency/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions stock_landed_costs_currency/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019 Komit Consulting - Duc Dao Dong
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Stock Landed Costs Currency",
"version": "17.0.1.0.0",
"author": "Komit Consulting, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Stock Accounting",
"website": "https://github.com/OCA/stock-logistics-workflow",
"depends": ["stock_landed_costs"],
"data": ["views/stock_landed_cost_views.xml"],
"installable": True,
}
43 changes: 43 additions & 0 deletions stock_landed_costs_currency/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_landed_costs_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-30 13:35+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_price_unit
msgid "Cost"
msgstr "Coste"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__price_unit
msgid "Cost in Company Currency"
msgstr "Coste en Divisa de la Compañía"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost__currency_id
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_id
msgid "Currency"
msgstr "Divisa"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost
msgid "Stock Landed Cost"
msgstr "Existencias Coste de Desembarque"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost_lines
msgid "Stock Landed Cost Line"
msgstr "Línea Existencias de Costes de Destino"
43 changes: 43 additions & 0 deletions stock_landed_costs_currency/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_landed_costs_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-13 13:34+0000\n"
"Last-Translator: Pierre-François Teyssier <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_price_unit
msgid "Cost"
msgstr "Coût"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__price_unit
msgid "Cost in Company Currency"
msgstr "Coût dans le devise de la société"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost__currency_id
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_id
msgid "Currency"
msgstr "Devise"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost
msgid "Stock Landed Cost"
msgstr "Coût logistique"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost_lines
msgid "Stock Landed Cost Line"
msgstr "Ligne de coût logisitique"
43 changes: 43 additions & 0 deletions stock_landed_costs_currency/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_landed_costs_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-17 09:33+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_price_unit
msgid "Cost"
msgstr "Costo"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__price_unit
msgid "Cost in Company Currency"
msgstr "Costo nella valuta aziendale"

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost__currency_id
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_id
msgid "Currency"
msgstr "Valuta"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost
msgid "Stock Landed Cost"
msgstr "Costo sbarcato di magazzino"

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost_lines
msgid "Stock Landed Cost Line"
msgstr "Riga costo sbarcato di magazzino"
40 changes: 40 additions & 0 deletions stock_landed_costs_currency/i18n/stock_landed_costs_currency.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_landed_costs_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_price_unit
msgid "Cost"
msgstr ""

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__price_unit
msgid "Cost in Company Currency"
msgstr ""

#. module: stock_landed_costs_currency
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost__currency_id
#: model:ir.model.fields,field_description:stock_landed_costs_currency.field_stock_landed_cost_lines__currency_id
msgid "Currency"
msgstr ""

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost
msgid "Stock Landed Cost"
msgstr ""

#. module: stock_landed_costs_currency
#: model:ir.model,name:stock_landed_costs_currency.model_stock_landed_cost_lines
msgid "Stock Landed Cost Line"
msgstr ""
2 changes: 2 additions & 0 deletions stock_landed_costs_currency/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_landed_cost
from . import stock_landed_cost_lines
24 changes: 24 additions & 0 deletions stock_landed_costs_currency/models/stock_landed_cost.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019 Komit Consulting - Duc Dao Dong
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models


class LandedCost(models.Model):
_inherit = "stock.landed.cost"

currency_id = fields.Many2one(
comodel_name="res.currency",
required=True,
related=None,
default=lambda self: self.env.company.currency_id,
)

@api.onchange("account_journal_id")
def _onchange_account_journal_id(self):
if self.account_journal_id and self.account_journal_id.currency_id:
self.currency_id = self.account_journal_id.currency_id

@api.onchange("currency_id")
def _onchange_currency_id(self):
if self.currency_id:
self.cost_lines._onchange_currency_price_unit()
30 changes: 30 additions & 0 deletions stock_landed_costs_currency/models/stock_landed_cost_lines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2019 Komit Consulting - Duc Dao Dong
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models


class LandedCostLine(models.Model):
_inherit = "stock.landed.cost.lines"

price_unit = fields.Float(string="Cost in Company Currency")
currency_id = fields.Many2one(related="cost_id.currency_id")
currency_price_unit = fields.Monetary(currency_field="currency_id", string="Cost")

@api.onchange("currency_price_unit")
def _onchange_currency_price_unit(self):
for rec in self:
if rec.currency_price_unit:
date = rec.cost_id.date
company = rec.cost_id.company_id
if rec.cost_id.currency_id != company.currency_id:
rec.price_unit = rec.cost_id.currency_id._convert(
rec.currency_price_unit, company.currency_id, company, date
)
else:
rec.price_unit = rec.currency_price_unit

@api.onchange("product_id")
def onchange_product_id(self):
res = super().onchange_product_id()
self.currency_price_unit = self.price_unit
return res
3 changes: 3 additions & 0 deletions stock_landed_costs_currency/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions stock_landed_costs_currency/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure this module, you need to:

1. Enable Multi-Currencies configuration
2. Go to your user settings.
3. Tick the box *Multi Currencies* in *Extra Rights*.
8 changes: 8 additions & 0 deletions stock_landed_costs_currency/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- Duc, Dao Dong \<<[email protected]>\>
(<https://komit-consulting.com>)
- Pimolnat Suntian \<<[email protected]>\>
(<https://ecosoft.co.th>)
- Jan Dziurzyński \<<[email protected]>\>
(<https://braintec.com>)
- [APSL-Nagarro](https://apsl.tech):
- Antoni Marroig \<<[email protected]>\>
2 changes: 2 additions & 0 deletions stock_landed_costs_currency/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows user to add landed costs in different currencies to
cost of products
9 changes: 9 additions & 0 deletions stock_landed_costs_currency/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To use this module, you need to:

\# Go to *Inventory \> Operations \> Landed Costs* and choose the
*Account Journal* and the corresponding *Currency* \# Add a cost line
and set the *Cost* column with the amount in that *Currency* \# The
amount in column *Cost in Company Currency* will be automatically
converted to Company's currency by the exchange rate on the Date of
Landed Cost \# After clicking "Validate", your products has been valued
with amounts in a consistent currency (which is Company's currency)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading