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

=================================
Stock account move reset to draft
=================================

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

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

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

This module allows a vendor bill to be reverted to draft status even
when an SVL (Stock Valuation Layer) record is created due to a price
difference between the receipt and the vendor bill, when inventory from
the receipt has yet to be consumed. When a vendor bill is reset to
draft, as applicable, a new SVL record is generated to offset the
valuation difference that was generated upon the bill's confirmation.

**Table of contents**

.. contents::
   :local:

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

Typically, when a purchase invoice is created at a price different from
the price at which the SVLs of the incoming picking were initially
created and confirmed, SVLs are generated to account for the price
difference. Once this happens, the invoice cannot normally be reverted
to draft due to stock_account restrictions.

Imagine international business settings where exchange rates are updated
daily; this limitation can be problematic. For example, if goods are
received on April 17th and the vendor bill is processed on April 18th
with a different exchange rate, an SVL record is generated, locking the
vendor bill. If a user then realizes a mistake, such as processing the
bill for the incorrect purchase order, they are unable to cancel it.

Usage
=====

1. Create a product category with Costing Method: Average Cost (AVCO) or
   First In First Out (FIFO).
2. Create a product linked to the category created before.
3. Create a purchase order and adds a product line with quantity 1 and
   price 10.
4. Confirms the purchase order and validates the incoming picking.
5. Creates an invoice from the purchase order.
6. Changes the invoice line price to 12 and confirm the invoice.
7. It is possible to reset the invoice to draft (a new SVL record to
   offset the existing SVL difference will be created).

When attempting to reset an invoice to draft for a product that has been
partially or fully consumed, the system will display the following error
message: "The inventory has already been (partially) consumed." In that
case, consider using landed costs to adjust the valuation of the product
as necessary.

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

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

  - Víctor Martínez
  - Pedro M. Baeza

- ``Quartile <https://www.quartile.co>``\ \_:

  - Yoshi Tashiro
  - Aung Ko Ko Lin

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

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

|maintainer-victoralmau| 

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/18.0/stock_account_move_reset_to_draft>`_ project on GitHub.

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