Skip to content

Commit

Permalink
[ADD][11.0] purchase_order_general_discount: New Module
Browse files Browse the repository at this point in the history
  • Loading branch information
chienandalu authored and OCA-git-bot committed Aug 30, 2019
1 parent fbc9c75 commit 0f6b7a0
Show file tree
Hide file tree
Showing 21 changed files with 1,143 additions and 0 deletions.
120 changes: 120 additions & 0 deletions purchase_order_general_discount/README.rst
@@ -0,0 +1,120 @@
===============================
Purchase Order General Discount
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/11.0/purchase_order_general_discount
: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-11-0/purchase-workflow-11-0-purchase_order_general_discount
: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/11.0
:alt: Try me on Runbot

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

This module allows to set a general discount in a purchase order. This general
discount is applied to each line order.

You can also set a default general discount on suppliers and configure to wich
line field the discount will be applied.

**Table of contents**

.. contents::
:local:

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

You can set in settings another discount field to be applied.
For example, if we had `purchase_triple_discount`, we could set the general
discount in discount3 to be applied after all other discounts.

To do so:

#. Go to *Purchases > Configuration > Settings* and *Purchase Discount Field*
#. Select the discount you'd wish to use. `purchase_triple_discount` fields
will appear when the module is installed.

There's a method at `res.company` called `_get_purchase_discount_fields` that
can be used to extend more line discount fields. For example, if we had the
field `discount4`, we could extend it like this:

.. code-block:: python
@api.model
def _get_purchase_discount_fields(self):
discount_fields = super()._get_purchase_discount_fields()
discount_fields += [('discount4', _('Discount 4'))]
return discount_fields
Usage
=====

To set a partner default general discount you need to:

#. Go to a partner and set the general discount in *Sales & Purchases* tab.

To set a general discount in a purchase order you need to:

#. Create a purchase order.
#. Either select a partner with a purchase general discount defined or set one
in the summary section of the order.
#. This discount will be applied to every line.

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_order_general_discount%0Aversion:%2011.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
* Pedro M. Baeza
* Rafael Blasco

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/11.0/purchase_order_general_discount>`_ 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_order_general_discount/__init__.py
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions purchase_order_general_discount/__manifest__.py
@@ -0,0 +1,22 @@
# Copyright 2019 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Purchase Order General Discount',
'summary': 'General discount per purchase order',
'version': '11.0.1.0.0',
'category': 'Purchases',
'website': 'https://github.com/OCA/purchase-workflow',
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': [
'purchase_discount',
],
'data': [
'views/purchase_order_view.xml',
'views/res_partner_view.xml',
'views/res_config_view.xml',
],
}
107 changes: 107 additions & 0 deletions purchase_order_general_discount/i18n/es.po
@@ -0,0 +1,107 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_general_discount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-28 12:50+0000\n"
"PO-Revision-Date: 2019-08-28 12:50+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: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-specific.\" groups=\"base.group_multi_company\"/>"
msgstr "<span class=\"fa fa-lg fa-building-o\" title=\"Los valores establecidos aquí son específicos para cada compañía.\" groups=\"base.group_multi_company\"/>"

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_company
msgid "Companies"
msgstr "Compañías"

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:22
#, python-format
msgid "Discount"
msgstr "Descuento"

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:27
#, python-format
msgid "Discount 2"
msgstr "Descuento 2"

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:28
#, python-format
msgid "Discount 3"
msgstr "Descuento 3"

#. module: purchase_order_general_discount
#: sql_constraint:purchase.order:0
msgid "Discount must be lower than 100%."
msgstr "El descuento debe ser menor del 100%."

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "Field"
msgstr "Campo"

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_purchase_order_general_discount
msgid "Gen. Disc. (%)"
msgstr "Desc. Gen. (%)"

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_company_purchase_general_discount_field
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_config_settings_purchase_general_discount_field
msgid "Purchase Discount Field"
msgstr "Campo para Descuento General de compra"

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_partner_purchase_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_users_purchase_general_discount
msgid "Purchase General Discount (%)"
msgstr "Descuento General de Compra (%)"

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido de compra"

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de pedido de compra"

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "Select to which purchase line field will the purchase general discount be propagated."
msgstr "Escoja a qué campo del descuento de la línea de pedido se propagará el descuento general."

#. module: purchase_order_general_discount
#: model:ir.model.fields,help:purchase_order_general_discount.field_res_company_purchase_general_discount_field
#: model:ir.model.fields,help:purchase_order_general_discount.field_res_config_settings_purchase_general_discount_field
msgid "Set the purchase line discount field in wich the discounts will be applied."
msgstr "Establecer el campo de descuento de la línea de pedido en el que se aplicará el descuento."

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.purchase_order_form
msgid "Update general discounts"
msgstr "Actualizar descuento general"

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_config_settings
msgid "res.config.settings"
msgstr "res.config.settings"
@@ -0,0 +1,108 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_general_discount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-28 12:49+0000\n"
"PO-Revision-Date: 2019-08-28 12:49+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: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-specific.\" groups=\"base.group_multi_company\"/>"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_company
msgid "Companies"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_partner
msgid "Contact"
msgstr ""

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:22
#, python-format
msgid "Discount"
msgstr ""

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:27
#, python-format
msgid "Discount 2"
msgstr ""

#. module: purchase_order_general_discount
#: code:addons/purchase_order_general_discount/models/res_company.py:28
#, python-format
msgid "Discount 3"
msgstr ""

#. module: purchase_order_general_discount
#: sql_constraint:purchase.order:0
msgid "Discount must be lower than 100%."
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "Field"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_purchase_order_general_discount
msgid "General Discount (%)"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_company_purchase_general_discount_field
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_config_settings_purchase_general_discount_field
msgid "Purchase Discount Field"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_partner_purchase_general_discount
#: model:ir.model.fields,field_description:purchase_order_general_discount.field_res_users_purchase_general_discount
msgid "Purchase General Discount (%)"
msgstr ""

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

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.res_config_settings_view_form_purchase
msgid "Select to which purchase line field will the purchase general discount be propagated."
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model.fields,help:purchase_order_general_discount.field_res_company_purchase_general_discount_field
#: model:ir.model.fields,help:purchase_order_general_discount.field_res_config_settings_purchase_general_discount_field
msgid "Set the purchase line discount field in wich the discounts will be applied."
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.ui.view,arch_db:purchase_order_general_discount.purchase_order_form
msgid "Update general discounts"
msgstr ""

#. module: purchase_order_general_discount
#: model:ir.model,name:purchase_order_general_discount.model_res_config_settings
msgid "res.config.settings"
msgstr ""

4 changes: 4 additions & 0 deletions purchase_order_general_discount/models/__init__.py
@@ -0,0 +1,4 @@
from . import purchase_order
from . import res_company
from . import res_config_settings
from . import res_partner

0 comments on commit 0f6b7a0

Please sign in to comment.