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

[16.0][MIG] purchase force invoiced: Migration to 16.0 #1711

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0dc913c
[11.0][add][purchase_force_invoiced]
JordiBForgeFlow Jan 28, 2019
cb6222a
Apply suggestions from code review
HviorForgeFlow May 10, 2019
2ab47b0
[UPD] Update purchase_force_invoiced.pot
oca-travis Jul 3, 2019
b9532a4
[UPD] README.rst
OCA-git-bot Jul 3, 2019
1bcfb40
[MIG] purchase_force_invoiced: Migration to 12.0
MiquelRForgeFlow Jul 16, 2019
fa7cbcb
[UPD] Update purchase_force_invoiced.pot
oca-travis Jul 22, 2019
57d4932
[UPD] README.rst
OCA-git-bot Jul 29, 2019
ba23d41
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 2, 2019
019bec3
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 2, 2019
cddfcc7
[IMP] purchase_force_invoiced: black, isort
kongrattapong Dec 18, 2019
0c132f4
[MIG] purchase_force_invoiced: Migration to 13.0
kongrattapong Dec 20, 2019
903ab0c
[UPD] Update purchase_force_invoiced.pot
oca-travis Mar 26, 2021
e7eea78
[UPD] README.rst
OCA-git-bot Mar 26, 2021
3bd4d65
Update translation files
oca-transbot Mar 26, 2021
55bffb0
[14.0][MIG] purchase_force_invoiced: Migration to 14.0
Reyes4711-S73 Sep 20, 2021
b5b3d45
[UPD] Update purchase_force_invoiced.pot
oca-travis Jan 26, 2022
27536ee
[UPD] README.rst
OCA-git-bot Jan 26, 2022
37a742f
[FIX] purchase_force_invoiced: Adapt BI report to the check
pedrobaeza Jul 19, 2022
db426df
[IMP] purchase_force_invoiced: black, isort, prettier
AnnaPForgeFlow Jul 6, 2022
2a53348
[MIG] purchase_force_invoiced: Migration to 15.0
AnnaPForgeFlow Jul 6, 2022
a4d291b
[UPD] Update purchase_force_invoiced.pot
Oct 25, 2022
4d19d72
[UPD] README.rst
OCA-git-bot Oct 25, 2022
1d6d079
Update translation files
weblate Oct 25, 2022
de7d687
[IMP] purchase_force_invoiced: Add filter by company to avoid errors …
victoralmau Nov 30, 2022
a51cd78
purchase_force_invoiced 15.0.1.0.1
OCA-git-bot Nov 30, 2022
602311c
[IMP] purchase_force_invoiced: pre-commit stuff
RodrigoBM Jan 13, 2023
e13f533
[MIG] purchase_force_invoiced: Migration to 16.0
RodrigoBM Jan 13, 2023
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
96 changes: 96 additions & 0 deletions purchase_force_invoiced/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
=======================
Purchase Force Invoiced
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_force_invoiced
: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-15-0/purchase-workflow-15-0-purchase_force_invoiced
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/142/15.0
:alt: Try me on Runbot

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

This module adds the possibility for users to force the invoice status of the
purchase orders to 'No Bill to Receive', even when not all the
quantities, ordered or delivered, have been invoiced.

This feature is useful in the following scenario:

* The supplier disputes the quantities to be billed for, after the
products have been delivered to her/him, and you agree to reduce the
quantity to invoice (without expecting a refund).

* When migrating from a previous Odoo version, in some cases there is less
quantity billed to what was delivered, and you don't want these old purchase
orders to appear in your 'Waiting Bills' list.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Create a purchase order and confirm it.
#. Receive the products/services.
#. Create a vendor bill and reduce the invoiced quantity. The purchase order
invoicing status is 'Waiting Bills'.
#. Lock the Purchase Order and change its status to 'Done'.
#. Check the field 'Force Invoiced'.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_force_invoiced%0Aversion:%2015.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
~~~~~~~

* Forgeflow

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

* Jordi Ballester <[email protected]>
* Rattapong Chokmasermkul <[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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions purchase_force_invoiced/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from . import model
from . import reports
17 changes: 17 additions & 0 deletions purchase_force_invoiced/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 ForgeFlow S.L.
# Copyright 2019 Aleph Objects, Inc.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

{
"name": "Purchase Force Invoiced",
"summary": "Allows to force the billing status of the purchase order to "
'"Invoiced"',
"version": "16.0.1.0.0",
"author": "Forgeflow, Odoo Community Association (OCA)",
"category": "Purchase Management",
"license": "AGPL-3",
"website": "https://github.com/OCA/purchase-workflow",
"depends": ["purchase"],
"data": ["view/purchase_view.xml"],
"installable": True,
}
37 changes: 37 additions & 0 deletions purchase_force_invoiced/i18n/purchase_force_invoiced.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_force_invoiced
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_force_invoiced
#: model:ir.model.fields,field_description:purchase_force_invoiced.field_purchase_order__force_invoiced
msgid "Force Invoiced"
msgstr ""

#. module: purchase_force_invoiced
#: model:ir.model,name:purchase_force_invoiced.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_force_invoiced
#: model:ir.model,name:purchase_force_invoiced.model_purchase_report
msgid "Purchase Report"
msgstr ""

#. module: purchase_force_invoiced
#: model:ir.model.fields,help:purchase_force_invoiced.field_purchase_order__force_invoiced
msgid ""
"When you set this field, the purchase order will be considered as fully "
"billed, even when there may be ordered or delivered quantities pending to "
"bill. To use this field, the order must be in 'Locked' state"
msgstr ""
53 changes: 53 additions & 0 deletions purchase_force_invoiced/i18n/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_force_invoiced
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-09-02 14:40+0000\n"
"Last-Translator: 黎伟杰 <[email protected]>\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 3.8\n"

#. module: purchase_force_invoiced
#: model:ir.model.fields,field_description:purchase_force_invoiced.field_purchase_order__force_invoiced
msgid "Force Invoiced"
msgstr ""

#. module: purchase_force_invoiced
#: model:ir.model,name:purchase_force_invoiced.model_purchase_order
msgid "Purchase Order"
msgstr "采购订单"

#. module: purchase_force_invoiced
#: model:ir.model,name:purchase_force_invoiced.model_purchase_report
msgid "Purchase Report"
msgstr ""

#. module: purchase_force_invoiced
#: model:ir.model.fields,help:purchase_force_invoiced.field_purchase_order__force_invoiced
msgid ""
"When you set this field, the purchase order will be considered as fully "
"billed, even when there may be ordered or delivered quantities pending to "
"bill. To use this field, the order must be in 'Locked' state"
msgstr ""

#~ msgid "Force invoiced"
#~ msgstr "强制开具发票"

#~ msgid ""
#~ "When you set this field, the purchase order will be considered as fully "
#~ "billed, even when there may be ordered or delivered quantities pending to "
#~ "bill."
#~ msgstr ""
#~ "设置此字段时,即使订单或已交付的数量待处理,也会将采购订单视为已完成开票。"

#~ msgid "Invoice"
#~ msgstr "发票"
3 changes: 3 additions & 0 deletions purchase_force_invoiced/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from . import purchase
26 changes: 26 additions & 0 deletions purchase_force_invoiced/model/purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from odoo import api, fields, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

force_invoiced = fields.Boolean(
readonly=True,
states={"done": [("readonly", False)]},
copy=False,
help="When you set this field, the purchase order will be "
"considered as fully billed, even when there may be ordered "
"or delivered quantities pending to bill. To use this field, "
"the order must be in 'Locked' state",
)

@api.depends("force_invoiced")
def _get_invoiced(self):
res = super()._get_invoiced()
for order in self.filtered(
lambda po: po.force_invoiced and po.invoice_status == "to invoice"
):
order.invoice_status = "invoiced"
return res
2 changes: 2 additions & 0 deletions purchase_force_invoiced/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Jordi Ballester <[email protected]>
* Rattapong Chokmasermkul <[email protected]>
13 changes: 13 additions & 0 deletions purchase_force_invoiced/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This module adds the possibility for users to force the invoice status of the
purchase orders to 'No Bill to Receive', even when not all the
quantities, ordered or delivered, have been invoiced.

This feature is useful in the following scenario:

* The supplier disputes the quantities to be billed for, after the
products have been delivered to her/him, and you agree to reduce the
quantity to invoice (without expecting a refund).

* When migrating from a previous Odoo version, in some cases there is less
quantity billed to what was delivered, and you don't want these old purchase
orders to appear in your 'Waiting Bills' list.
6 changes: 6 additions & 0 deletions purchase_force_invoiced/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#. Create a purchase order and confirm it.
#. Receive the products/services.
#. Create a vendor bill and reduce the invoiced quantity. The purchase order
invoicing status is 'Waiting Bills'.
#. Lock the Purchase Order and change its status to 'Done'.
#. Check the field 'Force Invoiced'.
3 changes: 3 additions & 0 deletions purchase_force_invoiced/reports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from . import purchase_report
21 changes: 21 additions & 0 deletions purchase_force_invoiced/reports/purchase_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
# Copyright 2022 Tecnativa - Pedro M. Baeza

from odoo import models


class PurchaseReport(models.Model):
_inherit = "purchase.report"

def _select(self):
"""Put quantity to be billed as 0 if it has been forced."""
select_str = super()._select()
select_str = select_str.replace(
"case when t.purchase_method = 'purchase'",
"case when po.force_invoiced then 0.0 "
"else (case when t.purchase_method = 'purchase' ",
)
select_str = select_str.replace(
"end as qty_to_be_billed", "end) end as qty_to_be_billed"
)
return select_str
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading