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

[12.0] Undo removal of purchase_package_qty #2

Open
wants to merge 3 commits into
base: 12.0
Choose a base branch
from
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
75 changes: 75 additions & 0 deletions purchase_package_qty/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
===========================
Purchase - Package Quantity
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-grap%2Fgrap--odoo--incubator-lightgray.png?logo=github
:target: https://github.com/grap/grap-odoo-incubator/tree/12.0/purchase_package_qty
:alt: grap/grap-odoo-incubator

|badge1| |badge2| |badge3|

This module extends the functionality of purchase module to support package
quantity.

In the product supplierinfo, add a "Package Qty" field to register how many
purchase UoM of the product there are in the package the supplier uses.
All purchase lines for this product+supplier must have a quantity that is a
multiple of that package quantity.

For example:

* A supplier sells beers with a price per unit, thus the purchase UoM is PCE.
* The supplier put them in 6pcs boxes, and the purchaser have to buy a multiple
of 6.
* The supplier has a minimum quantity of 60.

So the settings of the product will be the following :

.. image:: https://raw.githubusercontent.com/grap/grap-odoo-incubator/12.0/purchase_package_qty/static/description/product_supplierinfo_form.png

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/grap/grap-odoo-incubator/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/grap/grap-odoo-incubator/issues/new?body=module:%20purchase_package_qty%0Aversion:%2012.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
~~~~~~~

* GRAP

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

* Julien WESTE
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)

Maintainers
~~~~~~~~~~~

This module is part of the `grap/grap-odoo-incubator <https://github.com/grap/grap-odoo-incubator/tree/12.0/purchase_package_qty>`_ project on GitHub.

You are welcome to contribute.
Empty file.
18 changes: 18 additions & 0 deletions purchase_package_qty/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Purchase - Package Quantity",
"version": "12.0.2.0.1",
"category": "Purchase",
"author": "GRAP",
"website": "https://github.com/grap/grap-odoo-incubator",
"license": "AGPL-3",
"depends": [
"purchase",
# Depend on our replacement module.
"product_supplierinfo_qty_multiplier",
],
}
22 changes: 22 additions & 0 deletions purchase_package_qty/migrations/12.0.2.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


def migrate(cr, version):
if not openupgrade.column_exists(cr, "product_supplierinfo", "multiplier_qty"):
cr.execute(
"""
ALTER TABLE product_supplierinfo
ADD COLUMN multiplier_qty double precision;
"""
)

cr.execute(
"""
UPDATE product_supplierinfo
SET multiplier_qty = package_qty;
"""
)
2 changes: 2 additions & 0 deletions purchase_package_qty/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Julien WESTE
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
18 changes: 18 additions & 0 deletions purchase_package_qty/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This module extends the functionality of purchase module to support package
quantity.

In the product supplierinfo, add a "Package Qty" field to register how many
purchase UoM of the product there are in the package the supplier uses.
All purchase lines for this product+supplier must have a quantity that is a
multiple of that package quantity.

For example:

* A supplier sells beers with a price per unit, thus the purchase UoM is PCE.
* The supplier put them in 6pcs boxes, and the purchaser have to buy a multiple
of 6.
* The supplier has a minimum quantity of 60.

So the settings of the product will be the following :

.. image:: ../static/description/product_supplierinfo_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions setup/purchase_package_qty/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,
)