Skip to content

Commit

Permalink
[ADD] shopfloor_purchase_base: Add optional purchase order data to pi…
Browse files Browse the repository at this point in the history
…cking

To get the purchase order within the picking data call data.picking with
kwarg with_purchase_order
  • Loading branch information
mt-software-de committed Aug 17, 2023
1 parent a6a746d commit ba831fd
Show file tree
Hide file tree
Showing 14 changed files with 614 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/shopfloor_purchase_base/setup.py
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,
)
81 changes: 81 additions & 0 deletions shopfloor_purchase_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
=======================
Shopfloor Purchase Base
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fwms-lightgray.png?logo=github
:target: https://github.com/OCA/wms/tree/14.0/shopfloor_purchase_base
:alt: OCA/wms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/wms-14-0/wms-14-0-shopfloor_purchase_base
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/wms&target_branch=14.0
:alt: Try me on Runboat

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

This is a glue module between `shopfloor` and `l10n_eu_product_adr`

**Table of contents**

.. contents::
:local:

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

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

* MT Software

Contributors
~~~~~~~~~~~~

* Matthieu Méquignon <[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.

.. |maintainer-mt-software-de| image:: https://github.com/mt-software-de.png?size=40px
:target: https://github.com/mt-software-de
:alt: mt-software-de

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

|maintainer-mt-software-de|

This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/14.0/shopfloor_purchase_base>`_ 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 shopfloor_purchase_base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import actions
17 changes: 17 additions & 0 deletions shopfloor_purchase_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Shopfloor Purchase Base",
"summary": "Module for Shopfloor Purchase Data connection",
"version": "14.0.1.0.0",
"category": "Inventory",
"website": "https://github.com/OCA/wms",
"author": "MT Software, Odoo Community Association (OCA)",
"maintainers": ["mt-software-de"],
"license": "AGPL-3",
"depends": [
"shopfloor",
"purchase",
],
"data": [],
}
2 changes: 2 additions & 0 deletions shopfloor_purchase_base/actions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import data
from . import schema
28 changes: 28 additions & 0 deletions shopfloor_purchase_base/actions/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.addons.component.core import Component
from odoo.addons.shopfloor_base.utils import ensure_model


class DataAction(Component):
_inherit = "shopfloor.data.action"

def _get_purchase_order_parser(self, **kw):
res = self._simple_record_parser()
res += [
"partner_ref",
]
return res

@ensure_model("purchase.order")
def purchase_order(self, record, **kw):
parser = self._get_purchase_order_parser(**kw)
return self._jsonify(record, parser, **kw)

def _get_picking_parser(self, record, **kw):
parser = super()._get_picking_parser(record, **kw)
if kw.get("with_purchase_order"):
parser.append(
("purchase_id:purchase_order", self._get_purchase_order_parser(**kw))
)
return parser
25 changes: 25 additions & 0 deletions shopfloor_purchase_base/actions/schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.addons.component.core import Component


class ShopfloorSchemaAction(Component):
_inherit = "shopfloor.schema.action"

def purchase_order(self):
return {
"id": {"required": True, "type": "integer"},
"name": {"type": "string", "nullable": False, "required": True},
"partner_ref": {"type": "string", "nullable": True, "required": False},
}

def picking(self, **kw):
res = super().picking(**kw)
res.update(
{
"purchase_order": self._schema_dict_of(
self.purchase_order(), required=False
)
}
)
return res
1 change: 1 addition & 0 deletions shopfloor_purchase_base/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Michael Tietz (MT Software) <[email protected]>
1 change: 1 addition & 0 deletions shopfloor_purchase_base/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a glue module between `shopfloor` and `l10n_eu_product_adr`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ba831fd

Please sign in to comment.