===============================
Purchase Order General Discount
===============================

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

.. |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%2Fpurchase--workflow-lightgray.png?logo=github
    :target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_general_discount
    :alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_general_discount
    :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/purchase-workflow&target_branch=16.0
    :alt: Try me on Runboat

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

This module allows to set a general discount in a purchase order. This general
discount is applied to each line order.

You can also set a default general discount on suppliers and configure to which
line field the discount will be applied.

**Table of contents**

.. contents::
   :local:

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

You can set in settings another discount field to be applied.
For example, if we had `purchase_triple_discount`, we could set the general
discount in discount3 to be applied after all other discounts.

To do so:

#. Go to *Purchases > Configuration > Settings* and *Purchase Discount Field*
#. Select the discount you'd wish to use. `purchase_triple_discount` fields
   will appear when the module is installed.

There's a method at `res.company` called `_get_purchase_discount_fields` that
can be used to extend more line discount fields. For example, if we had the
field `discount4`, we could extend it like this:

.. code-block:: python

    @api.model
    def _get_purchase_discount_fields(self):
        discount_fields = super()._get_purchase_discount_fields()
        discount_fields += [('discount4', _('Discount 4'))]
        return discount_fields

Usage
=====

To set a partner default general discount you need to:

#. Go to a partner and set the general discount in *Sales & Purchases* tab.

To set a general discount in a purchase order you need to:

#. Create a purchase order.
#. Either select a partner with a purchase general discount defined or set one
   in the summary section of the order.
#. This discount will be applied to every line.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-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/purchase-workflow/issues/new?body=module:%20purchase_order_general_discount%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
~~~~~~~

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:

    * David Vidal
    * Pedro M. Baeza
    * Rafael Blasco
    * Carlos Roca
    * Pilar Vargas

* `Aures TIC <https://www.aurestic.es>`_:

    * Jose Zambudio
    * Anna Martinez

* `Komit <https://komit-consulting.com>`_:

  * Cuong Nguyen Mtm <cuong.nmtm@komit-consulting.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.

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_general_discount>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
