From 4aba93e93adf1764db14be6df91eb47ff7f1541b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20B=C3=A9lorgey?= Date: Sun, 19 Jan 2020 01:43:52 +0100 Subject: [PATCH] [MIG] partner_default_sale_discount: Migration to 12.0 --- partner_default_sale_discount/README.rst | 84 ++-- partner_default_sale_discount/__init__.py | 3 +- partner_default_sale_discount/__manifest__.py | 20 + partner_default_sale_discount/__openerp__.py | 21 - .../models/__init__.py | 3 +- .../models/res_partner.py | 5 +- .../models/sale_order.py | 5 +- .../readme/CONFIGURE.rst | 14 + .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 3 + .../readme/USAGE.rst | 6 + .../static/description/index.html | 451 ++++++++++++++++++ .../tests/__init__.py | 3 +- .../test_partner_default_sale_discount.py | 5 +- .../views/res_partner_view.xml | 4 +- 15 files changed, 557 insertions(+), 71 deletions(-) create mode 100644 partner_default_sale_discount/__manifest__.py delete mode 100644 partner_default_sale_discount/__openerp__.py create mode 100644 partner_default_sale_discount/readme/CONFIGURE.rst create mode 100644 partner_default_sale_discount/readme/CONTRIBUTORS.rst create mode 100644 partner_default_sale_discount/readme/DESCRIPTION.rst create mode 100644 partner_default_sale_discount/readme/USAGE.rst create mode 100644 partner_default_sale_discount/static/description/index.html diff --git a/partner_default_sale_discount/README.rst b/partner_default_sale_discount/README.rst index 5f83f4adc..4da684a64 100644 --- a/partner_default_sale_discount/README.rst +++ b/partner_default_sale_discount/README.rst @@ -1,30 +1,54 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ================================== Default sales discount per partner ================================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/12.0-mig-partner_default_sale_discount/partner_default_sale_discount + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-12-0-mig-partner_default_sale_discount/partner-contact-12-0-mig-partner_default_sale_discount-partner_default_sale_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/134/12.0-mig-partner_default_sale_discount + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module allows to define at partner level a default discount to be applied on sales orders as the default one. As the field is a company dependent one, you can configure a different value for the partner for each of your companies. +**Table of contents** + +.. contents:: + :local: + Configuration ============= -Enabling the use of discounts in Odoo: +To configure this module, you need to: #. Go to *Sales > Configuration > Settings* -#. On the group "Quotations & Sales", select the option "Allow discounts on - sales order lines" for the "Discount" section. +#. On the group "Pricing", select the option "Discounts" to grant discounts on + sales order lines. Setting a default sales discount: -#. Then, go to *Sales > Customers*. +#. Then, go to *Sales > Orders > Customers*. #. Create or modify a customer. #. Go to "Sales & Purchases" page. -#. In the "Sale" section, there's a field called "Default sales discount (%)" +#. In the "Sales" section, there's a field called "Default sales discount (%)" where you can fill the default discount percentage. #. This value can only be filled at company partners, not for contacts. @@ -33,53 +57,47 @@ Usage To use this module, you need to: -#. Go to *Sales > Quotations*. +#. Go to *Sales > Orders > Quotations*. #. Create a new quotation. #. Select a partner with a default discount applied. #. Create an order line, and you will see this discount as default in the line. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/9.0 - -Known issues / Roadmap -====================== - -* This module doesn't work with *product_visible_discount*, as it overwrites - the discount field with its own value. - Bug Tracker =========== -Bugs are tracked on `GitHub 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. +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Tecnativa Contributors ------------- +~~~~~~~~~~~~ * Pedro M. Baeza -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_default_sale_discount/__init__.py b/partner_default_sale_discount/__init__.py index a77a6fcbc..4b76c7b2d 100644 --- a/partner_default_sale_discount/__init__.py +++ b/partner_default_sale_discount/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_default_sale_discount/__manifest__.py b/partner_default_sale_discount/__manifest__.py new file mode 100644 index 000000000..8c8c62a95 --- /dev/null +++ b/partner_default_sale_discount/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2016 Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Default sales discount per partner", + "version": "12.0.1.0.0", + "category": "Partner Management", + "license": "AGPL-3", + "author": "Tecnativa, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/partner-contact", + "depends": [ + "sale_management", + ], + "data": [ + "views/res_partner_view.xml", + "views/sale_order_view.xml", + ], + "installable": True, +} diff --git a/partner_default_sale_discount/__openerp__.py b/partner_default_sale_discount/__openerp__.py deleted file mode 100644 index a941132e8..000000000 --- a/partner_default_sale_discount/__openerp__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -{ - 'name': 'Default sales discount per partner', - 'version': '9.0.1.0.0', - 'category': 'Partner Management', - 'license': 'AGPL-3', - 'author': 'Tecnativa,' - 'Odoo Community Association (OCA)', - 'website': 'https://www.tecnativa.com', - 'depends': [ - 'sale', - ], - 'data': [ - 'views/res_partner_view.xml', - 'views/sale_order_view.xml', - ], - 'installable': True, -} diff --git a/partner_default_sale_discount/models/__init__.py b/partner_default_sale_discount/models/__init__.py index 409058b1f..cfe06e834 100644 --- a/partner_default_sale_discount/models/__init__.py +++ b/partner_default_sale_discount/models/__init__.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import res_partner from . import sale_order diff --git a/partner_default_sale_discount/models/res_partner.py b/partner_default_sale_discount/models/res_partner.py index 26ddb60cd..22beb1640 100644 --- a/partner_default_sale_discount/models/res_partner.py +++ b/partner_default_sale_discount/models/res_partner.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import fields, models +from odoo import fields, models class ResPartner(models.Model): diff --git a/partner_default_sale_discount/models/sale_order.py b/partner_default_sale_discount/models/sale_order.py index c6ba7c28c..da168aabc 100644 --- a/partner_default_sale_discount/models/sale_order.py +++ b/partner_default_sale_discount/models/sale_order.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models +from odoo import api, fields, models from lxml import etree diff --git a/partner_default_sale_discount/readme/CONFIGURE.rst b/partner_default_sale_discount/readme/CONFIGURE.rst new file mode 100644 index 000000000..a4eb261b4 --- /dev/null +++ b/partner_default_sale_discount/readme/CONFIGURE.rst @@ -0,0 +1,14 @@ +To configure this module, you need to: + +#. Go to *Sales > Configuration > Settings* +#. On the group "Pricing", select the option "Discounts" to grant discounts on + sales order lines. + +Setting a default sales discount: + +#. Then, go to *Sales > Orders > Customers*. +#. Create or modify a customer. +#. Go to "Sales & Purchases" page. +#. In the "Sales" section, there's a field called "Default sales discount (%)" + where you can fill the default discount percentage. +#. This value can only be filled at company partners, not for contacts. diff --git a/partner_default_sale_discount/readme/CONTRIBUTORS.rst b/partner_default_sale_discount/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..6e65dc11c --- /dev/null +++ b/partner_default_sale_discount/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Pedro M. Baeza diff --git a/partner_default_sale_discount/readme/DESCRIPTION.rst b/partner_default_sale_discount/readme/DESCRIPTION.rst new file mode 100644 index 000000000..f531320ba --- /dev/null +++ b/partner_default_sale_discount/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows to define at partner level a default discount to be applied +on sales orders as the default one. As the field is a company dependent one, +you can configure a different value for the partner for each of your companies. diff --git a/partner_default_sale_discount/readme/USAGE.rst b/partner_default_sale_discount/readme/USAGE.rst new file mode 100644 index 000000000..7f3a11e75 --- /dev/null +++ b/partner_default_sale_discount/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +#. Go to *Sales > Orders > Quotations*. +#. Create a new quotation. +#. Select a partner with a default discount applied. +#. Create an order line, and you will see this discount as default in the line. diff --git a/partner_default_sale_discount/static/description/index.html b/partner_default_sale_discount/static/description/index.html new file mode 100644 index 000000000..b753e8917 --- /dev/null +++ b/partner_default_sale_discount/static/description/index.html @@ -0,0 +1,451 @@ + + + + + + +Default sales discount per partner + + + +
+

Default sales discount per partner

+ + +

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

This module allows to define at partner level a default discount to be applied +on sales orders as the default one. As the field is a company dependent one, +you can configure a different value for the partner for each of your companies.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Sales > Configuration > Settings
  2. +
  3. On the group “Pricing”, select the option “Discounts” to grant discounts on +sales order lines.
  4. +
+

Setting a default sales discount:

+
    +
  1. Then, go to Sales > Orders > Customers.
  2. +
  3. Create or modify a customer.
  4. +
  5. Go to “Sales & Purchases” page.
  6. +
  7. In the “Sales” section, there’s a field called “Default sales discount (%)” +where you can fill the default discount percentage.
  8. +
  9. This value can only be filled at company partners, not for contacts.
  10. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Sales > Orders > Quotations.
  2. +
  3. Create a new quotation.
  4. +
  5. Select a partner with a default discount applied.
  6. +
  7. Create an order line, and you will see this discount as default in the line.
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/partner-contact project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/partner_default_sale_discount/tests/__init__.py b/partner_default_sale_discount/tests/__init__.py index 792199132..444e66b2c 100644 --- a/partner_default_sale_discount/tests/__init__.py +++ b/partner_default_sale_discount/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import test_partner_default_sale_discount diff --git a/partner_default_sale_discount/tests/test_partner_default_sale_discount.py b/partner_default_sale_discount/tests/test_partner_default_sale_discount.py index a1e59fe29..8e07c2608 100644 --- a/partner_default_sale_discount/tests/test_partner_default_sale_discount.py +++ b/partner_default_sale_discount/tests/test_partner_default_sale_discount.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp.tests import common +from odoo.tests import common from lxml import etree diff --git a/partner_default_sale_discount/views/res_partner_view.xml b/partner_default_sale_discount/views/res_partner_view.xml index bd053df89..fbf9104ab 100644 --- a/partner_default_sale_discount/views/res_partner_view.xml +++ b/partner_default_sale_discount/views/res_partner_view.xml @@ -5,13 +5,13 @@ res.partner - + - +