Metadata-Version: 2.1
Name: odoo-addon-sale_order_line_final_price
Version: 18.0.1.0.1
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Set the final price of a sale order line, and lock its unit price and discount for non sales managers
Home-page: https://github.com/OCA/sale-workflow
License: AGPL-3
Author: Tecnativa,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

===========================
Sale Order Line Final Price
===========================

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

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

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

This module adds a *Final Price* field to sale order lines, holding the
unit price once the discount is applied.

Setting it works out the discount that turns the price coming from the
pricelist into the agreed figure, so the catalog price stays visible on
the quotation and the rebate is recorded as such.

On top of that, the unit price and the discount become read only for
anyone who is not a *Sales Administrator*: salespeople state what the
customer pays, and the system works out the discount.

**Table of contents**

.. contents::
   :local:

Use Cases / Context
===================

Negotiations happen on the price the customer ends up paying, but a
quotation where that figure has been typed straight into the unit price
loses the only thing that tells you a rebate ever happened: the price of
the catalog. The line then reads as if the product were worth what was
agreed, the discount column stays at zero, and there is no way to tell a
well priced deal from a heavily discounted one, neither on the printed
quotation nor on any margin or discount report.

Odoo already has the right place to record that gap. The unit price is
what the pricelist says the product is worth, and the discount is what
was given away. So the list price is worth keeping untouched, and the
discount is worth keeping as the only thing that moves.

The catch is that salespeople don't negotiate in percentages, and asking
them to work out that 45.00 out of 49.90 is a 9.82% discount is asking
for typos and for unit prices quietly edited down instead. This module
closes that gap: the *Final Price* field takes the agreed figure, and
the discount is derived from it, so the pricelist price stays on the
line and the rebate is recorded as a rebate, without anybody having to
compute anything.

Locking the unit price and the discount for everyone but a *Sales
Administrator* is what keeps that invariant true. The two fields remain
the record of what the catalog said and what was conceded.

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

The discount is the only room the final price has to move in, so the
decimal precision of *Discount* is what says how exact the final price
can be. With the two decimals Odoo ships with, the leftover of the
rounding is at most ``unit price * 0.005 / 100`` per unit, which stays
under a cent on a single unit but adds up with the quantity: 10 units of
a line priced at 30.75 amount to 549.99 instead of the 550.00 asked for.

Raising the decimal precision of *Discount* (*Settings > Technical >
Decimal Accuracy*) to 5 or 6 digits drops that leftover below the cent
for any sensible price and quantity, and the amounts of the line then
add up to the final price.

Bear in mind that this precision rules every discount of the database,
and that discounts with that many decimals will be printed as such
unless the report is told otherwise.

Usage
=====

On any sale order line, fill in *Final Price* with the unit price agreed
with the customer. The discount is computed right away, keeping the unit
price given by the pricelist: a final price of 750.00 over 1,000.00
gives a 25% discount. Editing the unit price or the discount refreshes
the final price instead.

A line whose pricelist price is zero is the exception. No discount can
ever lift that price up to the agreed figure, and there is no catalog
price worth keeping either, so the final price is written straight into
the unit price and the discount stays at zero.

The discount is the only figure that moves, so the final price can only
be reached as close as the *Discount* decimal precision allows. When the
requested figure is out of reach, the line settles for the closest one,
and the final price shown is always what the line is really worth:
asking for 333.33 over 1,000.00 gives a 66.67% discount, which is
333.30.

That leftover can also stay out of sight on the final price and still
show up on the amount of the line: 30.75 with the -78.86% needed to
reach 55.00 is 54.99945 per unit, so 10 units amount to 549.99 instead
of 550.00. Raising the decimal precision of *Discount* narrows the gap.

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

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

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__:

  - Eduardo Ezerouali
  - Pedro M. Baeza

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-eduezerouali-tecnativa| image:: https://github.com/eduezerouali-tecnativa.png?size=40px
    :target: https://github.com/eduezerouali-tecnativa
    :alt: eduezerouali-tecnativa

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

|maintainer-eduezerouali-tecnativa| 

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_line_final_price>`_ project on GitHub.

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