Skip to content

Commit

Permalink
Merge PR #1602 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by bguillot
  • Loading branch information
OCA-git-bot committed Jan 24, 2024
2 parents 44ad812 + 8bbc624 commit f69e45f
Show file tree
Hide file tree
Showing 20 changed files with 945 additions and 0 deletions.
90 changes: 90 additions & 0 deletions purchase_invoicing_no_zero_line/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
===============================
Purchase invoicing no zero line
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cfc41c7c2b9f9b78a415d823ec5715f7c47d3d4126a054c620caa373ee92fa73
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/16.0/purchase_invoicing_no_zero_line
: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-16-0/account-invoicing-16-0-purchase_invoicing_no_zero_line
: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=16.0
:alt: Try me on Runboat

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

This module adds the possibility to avoid creating purchase invoice lines without
quantity.

**Table of contents**

.. contents::
:local:

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

#. Go to *Invoicing > Configuration > Journals*.
#. Enable *Avoid zero lines*.
#. Save.

NOTE: This option is only available for journals of type "purchase".

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:%20purchase_invoicing_no_zero_line%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
~~~~~~~

* Digital5 S.L.

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

* Digital5, S.L. <jonerikceberio@digital5.es>
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca
* Florian da Costa <florian.dacosta@akretion.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/account-invoicing <https://github.com/OCA/account-invoicing/tree/16.0/purchase_invoicing_no_zero_line>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions purchase_invoicing_no_zero_line/__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).

from . import models
14 changes: 14 additions & 0 deletions purchase_invoicing_no_zero_line/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Digital5 S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase invoicing no zero line",
"summary": "Avoid creation of zero quantity invoice lines from purchase",
"version": "16.0.1.0.0",
"category": "Purchase Management",
"author": "Digital5 S.L., Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/account-invoicing",
"installable": True,
"depends": ["purchase"],
"data": ["views/account_view.xml"],
}
44 changes: 44 additions & 0 deletions purchase_invoicing_no_zero_line/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoicing_no_zero_line
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-07-17 12:43+0000\n"
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
"Language-Team: none\n"
"Language: de\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 3.7.1\n"

#. module: purchase_invoicing_no_zero_line
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid "Avoid zero lines"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid ""
"If this option is checked, the purchase invoices in this journal will have "
"no lines with zero quantity"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_journal
msgid "Journal"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_move
msgid "Journal Entries"
msgstr ""

#~ msgid "Invoice"
#~ msgstr "Rechnung"
47 changes: 47 additions & 0 deletions purchase_invoicing_no_zero_line/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoicing_no_zero_line
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-15 15:22+0000\n"
"PO-Revision-Date: 2019-02-15 16:23+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.2.1\n"

#. module: purchase_invoicing_no_zero_line
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid "Avoid zero lines"
msgstr "Evitar líneas a cero"

#. module: purchase_invoicing_no_zero_line
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid ""
"If this option is checked, the purchase invoices in this journal will have "
"no lines with zero quantity"
msgstr ""
"Si se marca esta opción, las facturas de compra en este diario no se crearán "
"con líneas a cantidad cero"

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_journal
msgid "Journal"
msgstr "Diario"

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_move
msgid "Journal Entries"
msgstr ""

#~ msgid "Invoice"
#~ msgstr "Factura"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoicing_no_zero_line
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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_invoicing_no_zero_line
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,field_description:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid "Avoid zero lines"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_bank_statement_import_journal_creation__avoid_zero_lines
#: model:ir.model.fields,help:purchase_invoicing_no_zero_line.field_account_journal__avoid_zero_lines
msgid ""
"If this option is checked, the purchase invoices in this journal will have "
"no lines with zero quantity"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_journal
msgid "Journal"
msgstr ""

#. module: purchase_invoicing_no_zero_line
#: model:ir.model,name:purchase_invoicing_no_zero_line.model_account_move
msgid "Journal Entries"
msgstr ""
4 changes: 4 additions & 0 deletions purchase_invoicing_no_zero_line/models/__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).

from . import account_journal
from . import account_move
14 changes: 14 additions & 0 deletions purchase_invoicing_no_zero_line/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Digital5 S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class AccountJournal(models.Model):
_inherit = "account.journal"

avoid_zero_lines = fields.Boolean(
string="Avoid zero lines",
help="If this option is checked, the purchase invoices in this journal"
" will have no lines with zero quantity",
)
28 changes: 28 additions & 0 deletions purchase_invoicing_no_zero_line/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2019 Digital5 S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo.tools import float_is_zero


class AccountMove(models.Model):
_inherit = "account.move"

@api.onchange("purchase_vendor_bill_id", "purchase_id")
def _onchange_purchase_auto_complete(self):
"""
after the creation of the lines, delete the zero qty lines
if the journal is marked as such
"""
purchase = self.purchase_vendor_bill_id.purchase_order_id
res = super()._onchange_purchase_auto_complete()
if purchase and self.journal_id and self.journal_id.avoid_zero_lines:
zero_lines = self.invoice_line_ids.filtered(
lambda x: float_is_zero(
x.quantity,
precision_rounding=x.product_uom_id.rounding,
)
and x.purchase_line_id.order_id == purchase
)
self.invoice_line_ids -= zero_lines
return res
5 changes: 5 additions & 0 deletions purchase_invoicing_no_zero_line/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#. Go to *Invoicing > Configuration > Journals*.
#. Enable *Avoid zero lines*.
#. Save.

NOTE: This option is only available for journals of type "purchase".
5 changes: 5 additions & 0 deletions purchase_invoicing_no_zero_line/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Digital5, S.L. <jonerikceberio@digital5.es>
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca
* Florian da Costa <florian.dacosta@akretion.com>
2 changes: 2 additions & 0 deletions purchase_invoicing_no_zero_line/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds the possibility to avoid creating purchase invoice lines without
quantity.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f69e45f

Please sign in to comment.