Skip to content

Commit

Permalink
[ADD] sale_force_whole_invoiceability: New module
Browse files Browse the repository at this point in the history
  • Loading branch information
chienandalu committed Feb 15, 2021
1 parent c38c050 commit 13ad805
Show file tree
Hide file tree
Showing 15 changed files with 785 additions and 0 deletions.
92 changes: 92 additions & 0 deletions sale_force_whole_invoiceability/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
===============================
Sale Force Whole Invoiceability
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/12.0/sale_force_whole_invoiceability
: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-12-0/sale-workflow-12-0-sale_force_whole_invoiceability
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/167/12.0
:alt: Try me on Runbot

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

This module allows to the sale managers to force all the lines to invoice independently
of the invoice policy and the delivered quantities of the products.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

#. Make a sale order with products with a `delivered quantities` invoice policy.
#. Confirm the order.
#. If you try to invoice the order, you can't as the quantities aren't delivered.
#. But if you are a `Sales Manager`, you have a new button *Force Invoice Policy*
#. Once clicked, you can invoice all the lines as if they were already delivered.

Known issues / Roadmap
======================

- Modifiying the original demand after the forcing could lead to misscalculations.

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

* David Vidal

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/sale-workflow <https://github.com/OCA/sale-workflow/tree/12.0/sale_force_whole_invoiceability>`_ 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 sale_force_whole_invoiceability/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions sale_force_whole_invoiceability/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Force Whole Invoiceability",
"version": "12.0.1.0.0",
"category": "Sales",
"author": "Tecnativa,"
"Odoo Community Association (OCA)",
"website": "https://www.github.com/OCA/sale-workflow",
"license": "AGPL-3",
"depends": [
"sale",
],
"data": [
"views/sale_order_views.xml",
],
"installable": True,
}
44 changes: 44 additions & 0 deletions sale_force_whole_invoiceability/i18n/es.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:
# * sale_force_whole_invoiceability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-05 16:06+0000\n"
"PO-Revision-Date: 2021-02-05 16:06+0000\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: sale_force_whole_invoiceability
#: model_terms:ir.ui.view,arch_db:sale_force_whole_invoiceability.view_order_form
msgid "Force Invoice Policy"
msgstr "Forzar Política de Facturación"

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:13
#, python-format
msgid "Only Sales Managers are allowed to force the lines to invoice"
msgstr "Solo los Responsables de Ventas tienen permiso para forzar las líneas a facturar"

#. module: sale_force_whole_invoiceability
#: model:ir.model,name:sale_force_whole_invoiceability.model_sale_order
msgid "Sale Order"
msgstr "Pedido de venta"

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:21
#, python-format
msgid "You can't perform this action once the order has been invoiced once already"
msgstr "No puedes ejecutar esta acción una vez que el pedido ya ha sido facturado una vez"

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:17
#, python-format
msgid "You can't perform this action over a sale order in this state"
msgstr "No puedes ejecutar esta acción sobre una venta que está en este estado"
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_force_whole_invoiceability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-05 16:06+0000\n"
"PO-Revision-Date: 2021-02-05 16:06+0000\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: sale_force_whole_invoiceability
#: model_terms:ir.ui.view,arch_db:sale_force_whole_invoiceability.view_order_form
msgid "Force Invoice Policy"
msgstr ""

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:13
#, python-format
msgid "Only Sales Managers are allowed to force the lines to invoice"
msgstr ""

#. module: sale_force_whole_invoiceability
#: model:ir.model,name:sale_force_whole_invoiceability.model_sale_order
msgid "Sale Order"
msgstr ""

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:21
#, python-format
msgid "You can't perform this action once the order has been invoiced once already"
msgstr ""

#. module: sale_force_whole_invoiceability
#: code:addons/sale_force_whole_invoiceability/models/sale_order.py:17
#, python-format
msgid "You can't perform this action over a sale order in this state"
msgstr ""

1 change: 1 addition & 0 deletions sale_force_whole_invoiceability/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
25 changes: 25 additions & 0 deletions sale_force_whole_invoiceability/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, models
from odoo.exceptions import UserError


class SaleOrder(models.Model):
_inherit = "sale.order"

def force_lines_to_invoice_policy_order(self):
"""Wrapper to launch the private method from UI"""
if not self.user_has_groups("sales_team.group_sale_manager"):
raise UserError(_(
"Only Sales Managers are allowed to force the lines to invoice"
))
if self.state != "sale":
raise UserError(_(
"You can't perform this action over a sale order in this state"
))
if self.invoice_count:
raise UserError(_(
"You can't perform this action once the order has been "
"invoiced once already"
))
self._force_lines_to_invoice_policy_order()
3 changes: 3 additions & 0 deletions sale_force_whole_invoiceability/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* David Vidal
2 changes: 2 additions & 0 deletions sale_force_whole_invoiceability/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to the sale managers to force all the lines to invoice independently
of the invoice policy and the delivered quantities of the products.
1 change: 1 addition & 0 deletions sale_force_whole_invoiceability/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Modifiying the original demand after the forcing could lead to misscalculations.
7 changes: 7 additions & 0 deletions sale_force_whole_invoiceability/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module, you need to:

#. Make a sale order with products with a `delivered quantities` invoice policy.
#. Confirm the order.
#. If you try to invoice the order, you can't as the quantities aren't delivered.
#. But if you are a `Sales Manager`, you have a new button *Force Invoice Policy*
#. Once clicked, you can invoice all the lines as if they were already delivered.
Loading

0 comments on commit 13ad805

Please sign in to comment.