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

[18.0][MIG] purchase_invoice_method: Migration to 18.0 #2491

Open
wants to merge 15 commits into
base: 18.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
100 changes: 100 additions & 0 deletions purchase_invoice_method/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
=======================
Purchase Invoice Method
=======================

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

.. |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/18.0/purchase_invoice_method
: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-18-0/purchase-workflow-18-0-purchase_invoice_method
: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=18.0
:alt: Try me on Runboat

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

This module adds the possibility for users to force the invoice status
of the purchase orders to 'Waiting Bills' so they can create a bill.
Also, you can force an "On ordered quantites" invoice method to "On
received quantites".

Example: you can bill a purchase even when you haven't received the
product/service.

**Table of contents**

.. contents::
:local:

Usage
=====

1. Create a purchase order and confirm it.
2. Go to page "Other information" and select an option of the "Invoice
Method" field.
3.

1. If "On ordered quantited" is selected you can bill a purchase even
you haven't received the product.

4.

1. If "On received quantited" is selected you cannot bill a purchase
if you haven't received the product.

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_invoice_method%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
-------

* CreuBlanca

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

- Enric Tobella <[email protected]>
- Kevin Luna <[email protected]>
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

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/18.0/purchase_invoice_method>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_invoice_method/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions purchase_invoice_method/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 CreuBlanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Purchase Invoice Method",
"summary": """
Allow to force the invoice method of a purchase""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "CreuBlanca, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"depends": ["purchase"],
"data": [
"views/purchase_order.xml",
],
"demo": [],
}
32 changes: 32 additions & 0 deletions purchase_invoice_method/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_method
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-04-18 08:37+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_invoice_method
#: model:ir.model.fields,field_description:purchase_invoice_method.field_purchase_order__invoice_method
msgid "Invoice Method"
msgstr "Método de Facturación"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order
msgid "Purchase Order"
msgstr "Orden de Compra"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea Orden de Compra"
32 changes: 32 additions & 0 deletions purchase_invoice_method/i18n/es_MX.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_method
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-17 21:00+0000\n"
"Last-Translator: Jesús Alan Ramos Rodríguez <[email protected]>\n"
"Language-Team: none\n"
"Language: es_MX\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_invoice_method
#: model:ir.model.fields,field_description:purchase_invoice_method.field_purchase_order__invoice_method
msgid "Invoice Method"
msgstr "Método de Factruación"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order
msgid "Purchase Order"
msgstr "Orden de Compra"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de Orden de Compra"
32 changes: 32 additions & 0 deletions purchase_invoice_method/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_method
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-24 15:34+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_invoice_method
#: model:ir.model.fields,field_description:purchase_invoice_method.field_purchase_order__invoice_method
msgid "Invoice Method"
msgstr "Metodo fatturazione"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Riga ordine di acquisto"
29 changes: 29 additions & 0 deletions purchase_invoice_method/i18n/purchase_invoice_method.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_method
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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_invoice_method
#: model:ir.model.fields,field_description:purchase_invoice_method.field_purchase_order__invoice_method
msgid "Invoice Method"
msgstr ""

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

#. module: purchase_invoice_method
#: model:ir.model,name:purchase_invoice_method.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""
1 change: 1 addition & 0 deletions purchase_invoice_method/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order
36 changes: 36 additions & 0 deletions purchase_invoice_method/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2023 CreuBlanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


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

invoice_method = fields.Selection(
lambda r: r.env["product.template"]._fields["purchase_method"].selection
)


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

@api.depends(
"invoice_lines.move_id.state",
"invoice_lines.quantity",
"qty_received",
"product_uom_qty",
"order_id.state",
"order_id.invoice_method",
)
def _compute_qty_invoiced(self):
ret = super()._compute_qty_invoiced()
for line in self.filtered(
lambda r: r.order_id.invoice_method
and r.order_id.state in ["purchase", "done"]
):
if line.order_id.invoice_method == "purchase":
line.qty_to_invoice = line.product_qty - line.qty_invoiced
elif line.order_id.invoice_method == "receive":
line.qty_to_invoice = line.qty_received - line.qty_invoiced
return ret
3 changes: 3 additions & 0 deletions purchase_invoice_method/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions purchase_invoice_method/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Enric Tobella \<<[email protected]>\>
- Kevin Luna \<<[email protected]>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
7 changes: 7 additions & 0 deletions purchase_invoice_method/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module adds the possibility for users to force the invoice status
of the purchase orders to 'Waiting Bills' so they can create a bill.
Also, you can force an "On ordered quantites" invoice method to "On
received quantites".

Example: you can bill a purchase even when you haven't received the
product/service.
7 changes: 7 additions & 0 deletions purchase_invoice_method/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
1. Create a purchase order and confirm it.
2. Go to page "Other information" and select an option of the "Invoice
Method" field.
3. 1. If "On ordered quantited" is selected you can bill a purchase
even you haven't received the product.
4. 1. If "On received quantited" is selected you cannot bill a
purchase if you haven't received the product.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading