From 8aa27377821208b5597aae2cc84e72a3c9949e52 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Fri, 20 Mar 2020 12:54:52 -0400 Subject: [PATCH] [ADD] contract_layout_category_hide_detail: new module --- .../README.rst | 129 +++++ .../__init__.py | 3 + .../__manifest__.py | 21 + .../models/__init__.py | 4 + .../models/abstract_contract_line.py | 17 + .../models/contract_line.py | 22 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 4 + .../readme/ROADMAP.rst | 1 + .../readme/USAGE.rst | 41 ++ .../static/description/index.html | 462 ++++++++++++++++++ .../description/readme-icons/eye-slash.png | Bin 0 -> 855 bytes .../static/description/readme-icons/eye.png | Bin 0 -> 982 bytes .../description/readme-icons/minus-circle.png | Bin 0 -> 645 bytes .../description/readme-icons/plus-circle.png | Bin 0 -> 948 bytes .../views/abstract_contract_line.xml | 18 + .../views/contract.xml | 42 ++ 17 files changed, 768 insertions(+) create mode 100644 contract_layout_category_hide_detail/README.rst create mode 100644 contract_layout_category_hide_detail/__init__.py create mode 100644 contract_layout_category_hide_detail/__manifest__.py create mode 100644 contract_layout_category_hide_detail/models/__init__.py create mode 100644 contract_layout_category_hide_detail/models/abstract_contract_line.py create mode 100644 contract_layout_category_hide_detail/models/contract_line.py create mode 100644 contract_layout_category_hide_detail/readme/CONTRIBUTORS.rst create mode 100644 contract_layout_category_hide_detail/readme/DESCRIPTION.rst create mode 100644 contract_layout_category_hide_detail/readme/ROADMAP.rst create mode 100644 contract_layout_category_hide_detail/readme/USAGE.rst create mode 100644 contract_layout_category_hide_detail/static/description/index.html create mode 100644 contract_layout_category_hide_detail/static/description/readme-icons/eye-slash.png create mode 100644 contract_layout_category_hide_detail/static/description/readme-icons/eye.png create mode 100644 contract_layout_category_hide_detail/static/description/readme-icons/minus-circle.png create mode 100644 contract_layout_category_hide_detail/static/description/readme-icons/plus-circle.png create mode 100644 contract_layout_category_hide_detail/views/abstract_contract_line.xml create mode 100644 contract_layout_category_hide_detail/views/contract.xml diff --git a/contract_layout_category_hide_detail/README.rst b/contract_layout_category_hide_detail/README.rst new file mode 100644 index 000000000..04fdd55b1 --- /dev/null +++ b/contract_layout_category_hide_detail/README.rst @@ -0,0 +1,129 @@ +==================================== +Contract layout category hide detail +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fcontract-lightgray.png?logo=github + :target: https://github.com/OCA/contract/tree/12.0/contract_layout_category_hide_detail + :alt: OCA/contract +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_layout_category_hide_detail + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/110/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to check/uncheck 'Show details' and +'Show subtotal' flags for *Recurring invoices section lines* +in Customer Contracts and Supplier Contracts so that +Invoices are generated with this information. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to *Invoicing -> Customers -> Customer Contracts* and create + a new *Contract*. +#. In *Recurring Invoices* tab add a section line. +#. Add some product lines. +#. Add a section line, but this time, click on the *plus-circle* + icon |plus-circle-icon| on your right. That icon will be replaced by + *minus-circle* icon |minus-circle-icon|. That means *Show subtotal* field is + set to False. (You can also set *Show subtotal* field to False/True + in the pop-up form when you click on the section line) +#. Add some product lines. +#. Add another section line and click on the *eye* icon |eye-icon| on your + right. That icon will be replaced by *eye-slash* icon |eye-slash-icon|. + That means *Show details* field is set to False. (You can also set + *Show details* field to False/True in the pop-up form when you + click on the section line) +#. Add some product lines. +#. Then, when the Invoice is generated, you will see that it will have the + information regarding "Show details" and "Show subtotal" specified in + the previous steps. + +For more information about *Show details* and *Show subtotal* flags in +Invoices: see `'Usage' section of the 'Sale layout category hide detail' +module `_ + +.. |eye-icon| image:: https://raw.githubusercontent.com/OCA/contract/12.0/contract_layout_category_hide_detail/static/description/readme-icons/eye.png + :alt: plus-circle icon + :width: 12 px + +.. |eye-slash-icon| image:: https://raw.githubusercontent.com/OCA/contract/12.0/contract_layout_category_hide_detail/static/description/readme-icons/eye-slash.png + :alt: minus-circle icon + :width: 12 px + +.. |plus-circle-icon| image:: https://raw.githubusercontent.com/OCA/contract/12.0/contract_layout_category_hide_detail/static/description/readme-icons/plus-circle.png + :alt: plus-circle icon + :width: 12 px + +.. |minus-circle-icon| image:: https://raw.githubusercontent.com/OCA/contract/12.0/contract_layout_category_hide_detail/static/description/readme-icons/minus-circle.png + :alt: minus-circle icon + :width: 12 px + +Known issues / Roadmap +====================== + +* Unit tests are needed + +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 +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Ernesto Tejeda + * Pedro M. Baeza + +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/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_layout_category_hide_detail/__init__.py b/contract_layout_category_hide_detail/__init__.py new file mode 100644 index 000000000..83e553ac4 --- /dev/null +++ b/contract_layout_category_hide_detail/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/contract_layout_category_hide_detail/__manifest__.py b/contract_layout_category_hide_detail/__manifest__.py new file mode 100644 index 000000000..35c123682 --- /dev/null +++ b/contract_layout_category_hide_detail/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2018-2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Contract layout category hide detail", + "summary": "Hide details for sections in Contract lines", + "version": "12.0.1.0.0", + "category": "Contract Management", + "website": "https://github.com/OCA/contract", + "author": "Tecnativa, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "contract", + "sale_layout_category_hide_detail", + ], + "data": [ + "views/abstract_contract_line.xml", + "views/contract.xml", + ], +} diff --git a/contract_layout_category_hide_detail/models/__init__.py b/contract_layout_category_hide_detail/models/__init__.py new file mode 100644 index 000000000..fb37df5c1 --- /dev/null +++ b/contract_layout_category_hide_detail/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import abstract_contract_line +from . import contract_line diff --git a/contract_layout_category_hide_detail/models/abstract_contract_line.py b/contract_layout_category_hide_detail/models/abstract_contract_line.py new file mode 100644 index 000000000..8083acd33 --- /dev/null +++ b/contract_layout_category_hide_detail/models/abstract_contract_line.py @@ -0,0 +1,17 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ContractAbstractContractLine(models.AbstractModel): + _inherit = 'contract.abstract.contract.line' + + show_details = fields.Boolean( + string="Show details", + default=True + ) + show_subtotal = fields.Boolean( + string="Show subtotal", + default=True + ) diff --git a/contract_layout_category_hide_detail/models/contract_line.py b/contract_layout_category_hide_detail/models/contract_line.py new file mode 100644 index 000000000..8e6e65fb1 --- /dev/null +++ b/contract_layout_category_hide_detail/models/contract_line.py @@ -0,0 +1,22 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, models + + +class ContractLine(models.Model): + _inherit = 'contract.line' + + @api.multi + def _prepare_invoice_line(self, invoice_id=False, invoice_values=False): + vals = super()._prepare_invoice_line(invoice_id, invoice_values) + # If the line has skip_zero_qty field (provided by contract_variable + # quantity module) set to 'True' and 'quantity' field' is zero then + # 'vals' will be equal to {} + if vals: + vals.update( + show_details=self.show_details, + show_subtotal=self.show_subtotal, + ) + return vals diff --git a/contract_layout_category_hide_detail/readme/CONTRIBUTORS.rst b/contract_layout_category_hide_detail/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..b31cef321 --- /dev/null +++ b/contract_layout_category_hide_detail/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Ernesto Tejeda + * Pedro M. Baeza diff --git a/contract_layout_category_hide_detail/readme/DESCRIPTION.rst b/contract_layout_category_hide_detail/readme/DESCRIPTION.rst new file mode 100644 index 000000000..85d29d7f9 --- /dev/null +++ b/contract_layout_category_hide_detail/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module allows you to check/uncheck 'Show details' and +'Show subtotal' flags for *Recurring invoices section lines* +in Customer Contracts and Supplier Contracts so that +Invoices are generated with this information. diff --git a/contract_layout_category_hide_detail/readme/ROADMAP.rst b/contract_layout_category_hide_detail/readme/ROADMAP.rst new file mode 100644 index 000000000..b86f1c5e5 --- /dev/null +++ b/contract_layout_category_hide_detail/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Unit tests are needed diff --git a/contract_layout_category_hide_detail/readme/USAGE.rst b/contract_layout_category_hide_detail/readme/USAGE.rst new file mode 100644 index 000000000..f4d524b8b --- /dev/null +++ b/contract_layout_category_hide_detail/readme/USAGE.rst @@ -0,0 +1,41 @@ +To use this module, you need to: + +#. Go to *Invoicing -> Customers -> Customer Contracts* and create + a new *Contract*. +#. In *Recurring Invoices* tab add a section line. +#. Add some product lines. +#. Add a section line, but this time, click on the *plus-circle* + icon |plus-circle-icon| on your right. That icon will be replaced by + *minus-circle* icon |minus-circle-icon|. That means *Show subtotal* field is + set to False. (You can also set *Show subtotal* field to False/True + in the pop-up form when you click on the section line) +#. Add some product lines. +#. Add another section line and click on the *eye* icon |eye-icon| on your + right. That icon will be replaced by *eye-slash* icon |eye-slash-icon|. + That means *Show details* field is set to False. (You can also set + *Show details* field to False/True in the pop-up form when you + click on the section line) +#. Add some product lines. +#. Then, when the Invoice is generated, you will see that it will have the + information regarding "Show details" and "Show subtotal" specified in + the previous steps. + +For more information about *Show details* and *Show subtotal* flags in +Invoices: see `'Usage' section of the 'Sale layout category hide detail' +module `_ + +.. |eye-icon| image:: ../static/description/readme-icons/eye.png + :alt: plus-circle icon + :width: 12 px + +.. |eye-slash-icon| image:: ../static/description/readme-icons/eye-slash.png + :alt: minus-circle icon + :width: 12 px + +.. |plus-circle-icon| image:: ../static/description/readme-icons/plus-circle.png + :alt: plus-circle icon + :width: 12 px + +.. |minus-circle-icon| image:: ../static/description/readme-icons/minus-circle.png + :alt: minus-circle icon + :width: 12 px diff --git a/contract_layout_category_hide_detail/static/description/index.html b/contract_layout_category_hide_detail/static/description/index.html new file mode 100644 index 000000000..2042536b9 --- /dev/null +++ b/contract_layout_category_hide_detail/static/description/index.html @@ -0,0 +1,462 @@ + + + + + + +Contract layout category hide detail + + + +
+

Contract layout category hide detail

+ + +

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

+

This module allows you to check/uncheck ‘Show details’ and +‘Show subtotal’ flags for Recurring invoices section lines +in Customer Contracts and Supplier Contracts so that +Invoices are generated with this information.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Invoicing -> Customers -> Customer Contracts and create +a new Contract.
  2. +
  3. In Recurring Invoices tab add a section line.
  4. +
  5. Add some product lines.
  6. +
  7. Add a section line, but this time, click on the plus-circle +icon plus-circle icon on your right. That icon will be replaced by +minus-circle icon minus-circle icon. That means Show subtotal field is +set to False. (You can also set Show subtotal field to False/True +in the pop-up form when you click on the section line)
  8. +
  9. Add some product lines.
  10. +
  11. Add another section line and click on the eye icon plus-circle icon on your +right. That icon will be replaced by eye-slash icon minus-circle icon. +That means Show details field is set to False. (You can also set +Show details field to False/True in the pop-up form when you +click on the section line)
  12. +
  13. Add some product lines.
  14. +
  15. Then, when the Invoice is generated, you will see that it will have the +information regarding “Show details” and “Show subtotal” specified in +the previous steps.
  16. +
+

For more information about Show details and Show subtotal flags in +Invoices: see ‘Usage’ section of the ‘Sale layout category hide detail’ +module

+
+
+

Known issues / Roadmap

+
    +
  • Unit tests are needed
  • +
+
+
+

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

+
    +
  • Tecnativa:
      +
    • Ernesto Tejeda
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/contract_layout_category_hide_detail/static/description/readme-icons/eye-slash.png b/contract_layout_category_hide_detail/static/description/readme-icons/eye-slash.png new file mode 100644 index 0000000000000000000000000000000000000000..310a7a4c432c0e9d50a59f4ecd24eece6a012dda GIT binary patch literal 855 zcmeAS@N?(olHy`uVBq!ia0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K67Tk6pHB_4PR&9jV<)W!&O3CuoH}`|`>#ce-34pEqa8 zO1A16-Q+9m$GV@Kw^+y;QXQ4}|$viaMQL~ULd%VteU z*sbiwaxOc3R{niAeTyfS#^-)qirgN0>s?|0%^u0e>mEhW0y(xBq_{ zRZV3{K`$XwNCdZQ%E|d30nQ+Yc;#oJ7>-tW^?dKGe^?qNSvcz>tcjxV8_xN~z zUei?mS-LMgVBYkA_1ESvwv#7s>6){Ib@imO!dlPM(Gg3n zqK_8YdhE)&2OC7#SE^>Kd5q z8XANc7+4t^TNxN@8yHy`7_7MT`VxwU-29Zxv`X9>ZuSS~0X0a1YzWRzD=AMbN@XZ7 iFW1Y=%Pvk%EJ)SMFG`>N&PEETh{4m<&t;ucLK6Vhk4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-GzZ+Rj;xUkjGiz z5n0T@z;^_M8K-LVNdpDhOFVsD*&nlWG4UGxPhp8>U|tIBQu=1e0!%ZLZ@D6QMOv z3qMwuscrLo_q+1`0uGzY&-={I9x%K3gNgGo+mB<{@1F&RxN3=OL`h0wNvc(HQ7VvP zFfuT-)HN{IH8cn@Ft9Q-wlX!)HZZa>Ft~W@zcz}7-29Zxv`X9>7PPxh2WpT6*$|wc qR#Ki=l*&+EUaps!mtCBkSdglhUz9%kosASw5re0zpUXO@geCwzdh3n= literal 0 HcmV?d00001 diff --git a/contract_layout_category_hide_detail/static/description/readme-icons/plus-circle.png b/contract_layout_category_hide_detail/static/description/readme-icons/plus-circle.png new file mode 100644 index 0000000000000000000000000000000000000000..cf7d62cc302cde1a227952048436c2b7c1dfc7df GIT binary patch literal 948 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-GzZ+Rj;xUkjGiz z5m^kh={g8AI%&+V01C2~c>21sKW67*w6aS6HwkDlQbGJ>|pR-!`RBiFGxdn$ji(lp5-yV}!`ecta>!r27HM)On{K{nceudDN zS%#O^X-$f;bd8lZRAxCId*OcWKCX-JWs?uGI=6n@t!$CC=}GR=m{k+!eyO}%mUe&J zO7<@r(mvJh^RqlvtDnxR+@INW!YeKQW9z{w4@xH=+a#lv^F*!wTE+Dv$Im{qD%7`_ zrB*)SRbF`0-I&aS-j2q;Kld-tgd}ZO`w{)YpAJ?e@yr zLoZ8~f2lmYv`1lM*rrz@ZU$MWc4vA@rx`bGugOq(d#FL&sOd)5$)@kN)1|6-B~P(P zovD*C$=b4DPA&JrJ?uMI){CjUs^iOAmwx$s&W(?gqXcGe4xHhfe=ykYU)$D&|D{8+$8s4VruxOV(Z+G|7BMF z(JMStaP5L$Mat3X`)v2HHfh@196kDJd-k$C7fBZswFj!L>avViNZhlH;S|x4`cQxKr y12ss3YzWRzD=AMbN@XZ7FW1Y=%Pvk%EJ)SMFG`>N&PEETh{4m<&t;ucLK6VV;FW#= literal 0 HcmV?d00001 diff --git a/contract_layout_category_hide_detail/views/abstract_contract_line.xml b/contract_layout_category_hide_detail/views/abstract_contract_line.xml new file mode 100644 index 000000000..b33cbb77f --- /dev/null +++ b/contract_layout_category_hide_detail/views/abstract_contract_line.xml @@ -0,0 +1,18 @@ + + + + contract.abstract.contract.line.hide.details + contract.abstract.contract.line + + + + + + + + + + + + diff --git a/contract_layout_category_hide_detail/views/contract.xml b/contract_layout_category_hide_detail/views/contract.xml new file mode 100644 index 000000000..3a5b114f6 --- /dev/null +++ b/contract_layout_category_hide_detail/views/contract.xml @@ -0,0 +1,42 @@ + + + + + contract.contract.form.hide.details + contract.contract + + + + + + + + + +