Skip to content
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
91 changes: 91 additions & 0 deletions purchase_sale_lot_intercompany/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
==============================
Purchase Sale Lot Intercompany
==============================

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

.. |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%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/18.0/purchase_sale_lot_intercompany
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-18-0/multi-company-18-0-purchase_sale_lot_intercompany
: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/multi-company&target_branch=18.0
:alt: Try me on Runboat

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

This module allows to propagate lot numbers from a purchase to a sale
line, in a multi-company context.

**Table of contents**

.. contents::
:local:

Usage
=====

Check the "Lots/Serial Numbers propagated in sale"

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/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/multi-company/issues/new?body=module:%20purchase_sale_lot_intercompany%0Aversion:%2018.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
-------

* Akretion

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

- Kévin Roche <kevin.roche@akretion.com>
- Guillaume MASSON <guillaume.masson@groupevoltaire.com>

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.

.. |maintainer-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px
:target: https://github.com/Kev-Roche
:alt: Kev-Roche

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Kev-Roche|

This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/18.0/purchase_sale_lot_intercompany>`_ 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 purchase_sale_lot_intercompany/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions purchase_sale_lot_intercompany/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Kévin Roche <kevin.roche@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Purchase Sale Lot Intercompany",
"summary": "Intercompany PO/SO lot number propagation",
"version": "18.0.1.0.0",
"category": "Purchase Management",
"website": "https://github.com/OCA/multi-company",
"author": "Akretion, Odoo Community Association (OCA)",
"maintainers": ["Kev-Roche"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale_order_lot_selection",
"purchase_lot",
"purchase_sale_stock_inter_company",
],
"data": [
"views/res_config_settings_views.xml",
],
}
77 changes: 77 additions & 0 deletions purchase_sale_lot_intercompany/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_sale_lot_intercompany
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-13 18:52+0000\n"
"PO-Revision-Date: 2023-03-13 19:54+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.2.2\n"

#. module: purchase_sale_lot_intercompany
#: model:ir.model,name:purchase_sale_lot_intercompany.model_res_company
msgid "Companies"
msgstr "Sociétés"

#. module: purchase_sale_lot_intercompany
#: model:ir.model,name:purchase_sale_lot_intercompany.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de config"

#. module: purchase_sale_lot_intercompany
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_purchase_order__display_name
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_company__display_name
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_config_settings__display_name
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_stock_production_lot__display_name
msgid "Display Name"
msgstr "Nom affiché"

#. module: purchase_sale_lot_intercompany
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_purchase_order__id
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_company__id
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_config_settings__id
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: purchase_sale_lot_intercompany
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_purchase_order____last_update
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_company____last_update
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_config_settings____last_update
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: purchase_sale_lot_intercompany
#: model:ir.model,name:purchase_sale_lot_intercompany.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lot/N° série"

#. module: purchase_sale_lot_intercompany
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_company__propagated_serial_number
msgid "Lots/Serial Numbers are propagated in this company"
msgstr "Lot/N° série copiés dans cette société"

#. module: purchase_sale_lot_intercompany
#: model:ir.model.fields,field_description:purchase_sale_lot_intercompany.field_res_config_settings__propagated_serial_number
msgid "Lots/Serial Numbers propagated in sale"
msgstr "Lot/N° série copiés dans les commandes de ventes"

#. module: purchase_sale_lot_intercompany
#: model_terms:ir.ui.view,arch_db:purchase_sale_lot_intercompany.res_config_settings_view_form
msgid "Propagated Lots from purchase to sale"
msgstr "Lot/N° série copiés des achats vers les commandes de ventes de cette société"

#. module: purchase_sale_lot_intercompany
#: model:ir.model,name:purchase_sale_lot_intercompany.model_purchase_order
msgid "Purchase Order"
msgstr "Commande fournisseur"
4 changes: 4 additions & 0 deletions purchase_sale_lot_intercompany/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import purchase_order
from . import stock_lot
from . import res_company
from . import res_config_settings
18 changes: 18 additions & 0 deletions purchase_sale_lot_intercompany/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Kévin Roche <kevin.roche@akretion.com>
# @author Guillaume MASSON <guillaume.masson@groupevoltaire.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

def _prepare_sale_order_line_data(self, purchase_line, dest_company, sale_order):
vals = super()._prepare_sale_order_line_data(
purchase_line, dest_company, sale_order
)
if dest_company.propagated_serial_number and purchase_line.lot_id:
vals["lot_id"] = purchase_line.lot_id.get_inter_company_lot(dest_company).id
return vals
14 changes: 14 additions & 0 deletions purchase_sale_lot_intercompany/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Kévin Roche <kevin.roche@akretion.com>
# @author Guillaume MASSON <guillaume.masson@groupevoltaire.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

propagated_serial_number = fields.Boolean(
string="Lots/Serial Numbers are propagated in this company"
)
16 changes: 16 additions & 0 deletions purchase_sale_lot_intercompany/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Kévin Roche <kevin.roche@akretion.com>
# @author Guillaume MASSON <guillaume.masson@groupevoltaire.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

propagated_serial_number = fields.Boolean(
string="Lots/Serial Numbers propagated in sale",
related="company_id.propagated_serial_number",
readonly=False,
)
30 changes: 30 additions & 0 deletions purchase_sale_lot_intercompany/models/stock_lot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Kévin Roche <kevin.roche@akretion.com>
# @author Guillaume MASSON <guillaume.masson@groupevoltaire.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class StockLot(models.Model):
_inherit = "stock.lot"

def prepare_intercompany_lot_values(self, company):
return {
"name": self.name,
"product_id": self.product_id.id,
"company_id": company.id,
}

def get_inter_company_lot(self, company):
self.ensure_one()
lot = self.sudo().search(
[
("name", "=", self.name),
("product_id", "=", self.product_id.id),
("company_id", "=", company.id),
]
)
if not lot:
lot = self.sudo().create(self.prepare_intercompany_lot_values(company))
return lot
3 changes: 3 additions & 0 deletions purchase_sale_lot_intercompany/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions purchase_sale_lot_intercompany/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Kévin Roche \<kevin.roche@akretion.com\>
- Guillaume MASSON \<guillaume.masson@groupevoltaire.com\>
2 changes: 2 additions & 0 deletions purchase_sale_lot_intercompany/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to propagate lot numbers from a purchase to a sale
line, in a multi-company context.
1 change: 1 addition & 0 deletions purchase_sale_lot_intercompany/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check the "Lots/Serial Numbers propagated in sale"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading