From 1fad059840a0b6e63538d89e988a893c56d15281 Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Fri, 11 Jun 2021 07:20:33 +0200 Subject: [PATCH 01/28] 13.0][ADD] sale_order_line_position This module adds an auto computed position on sale order line. This position number is added on the report. The position can be used to keep track of each line during the delivery, invoicing of the order with the customer. This is why there is related modules on `account-invoice-reporting` and `stock-logisics-reporting`. The position set on a line is not changed when the order is not in draft anymore. --- sale_order_line_position/README.rst | 99 ++++ sale_order_line_position/__init__.py | 1 + sale_order_line_position/__manifest__.py | 15 + .../i18n/sale_order_line_position.pot | 45 ++ sale_order_line_position/models/__init__.py | 2 + sale_order_line_position/models/sale_order.py | 28 ++ .../models/sale_order_line.py | 68 +++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 9 + sale_order_line_position/readme/ROADMAP.rst | 14 + .../report/sale_order_report.xml | 19 + .../static/description/index.html | 439 ++++++++++++++++++ sale_order_line_position/tests/__init__.py | 1 + .../tests/test_sale_order_line_position.py | 82 ++++ sale_order_line_position/views/sale_order.xml | 23 + 15 files changed, 846 insertions(+) create mode 100644 sale_order_line_position/README.rst create mode 100644 sale_order_line_position/__init__.py create mode 100644 sale_order_line_position/__manifest__.py create mode 100644 sale_order_line_position/i18n/sale_order_line_position.pot create mode 100644 sale_order_line_position/models/__init__.py create mode 100644 sale_order_line_position/models/sale_order.py create mode 100644 sale_order_line_position/models/sale_order_line.py create mode 100644 sale_order_line_position/readme/CONTRIBUTORS.rst create mode 100644 sale_order_line_position/readme/DESCRIPTION.rst create mode 100644 sale_order_line_position/readme/ROADMAP.rst create mode 100644 sale_order_line_position/report/sale_order_report.xml create mode 100644 sale_order_line_position/static/description/index.html create mode 100644 sale_order_line_position/tests/__init__.py create mode 100644 sale_order_line_position/tests/test_sale_order_line_position.py create mode 100644 sale_order_line_position/views/sale_order.xml diff --git a/sale_order_line_position/README.rst b/sale_order_line_position/README.rst new file mode 100644 index 000000000..4210d2a0f --- /dev/null +++ b/sale_order_line_position/README.rst @@ -0,0 +1,99 @@ +======================== +Sale 0rder Line Position +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/sale-reporting/tree/13.0/sale_order_line_position + :alt: OCA/sale-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-reporting-13-0/sale-reporting-13-0-sale_order_line_position + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/148/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds an auto computed position on sale order line. +This position number is added on the report. + +The position can be used to keep track of each line during +the delivery and invoicing of the order with the customer. +This is why there are related modules on `account-invoice-reporting` +and `stock-logisics-reporting`. + +The position is not changed on the line after the order has been send. + +**Table of contents** + +.. contents:: + :local: + +Known issues / Roadmap +====================== + +The way the positions are computed on the create of `sale.order.line` +record could lead to a performance issue. There is a few improvements +that have been suggested: + +Remove it and handle the computation on the write and/or create +method of the `sale.order`. + +Have a context key to enable/disable the recomputation. + +Do not set any value in the position fields before the sale order lines +are locked (in the current implementation, before sending). +And add a recompute button in the UI. + +Set the position values with an SQL query using a `TRIGGER`. + +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 +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Thierry Ducrest + +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-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_line_position/__init__.py b/sale_order_line_position/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/sale_order_line_position/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py new file mode 100644 index 000000000..3040c7a00 --- /dev/null +++ b/sale_order_line_position/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Sale 0rder Line Position", + "summary": "Adds position number on sale order line.", + "version": "13.0.1.0.0", + "category": "Sales", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/sale-reporting", + "depends": ["sale"], + "data": ["views/sale_order.xml", "report/sale_order_report.xml"], + "installable": True, +} diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot new file mode 100644 index 000000000..17e678cc5 --- /dev/null +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_line_position +# +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: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions +msgid "Locked Positions" +msgstr "" + +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.report_saleorder_document +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.view_order_form_inherit +msgid "Pos" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position +msgid "Position" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position_formatted +msgid "Position Formatted" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order_line +msgid "Sales Order Line" +msgstr "" diff --git a/sale_order_line_position/models/__init__.py b/sale_order_line_position/models/__init__.py new file mode 100644 index 000000000..2d7ee6c3d --- /dev/null +++ b/sale_order_line_position/models/__init__.py @@ -0,0 +1,2 @@ +from . import sale_order +from . import sale_order_line diff --git a/sale_order_line_position/models/sale_order.py b/sale_order_line_position/models/sale_order.py new file mode 100644 index 000000000..3e8c073b1 --- /dev/null +++ b/sale_order_line_position/models/sale_order.py @@ -0,0 +1,28 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + locked_positions = fields.Boolean(compute="_compute_locked_positions") + + @api.depends("state") + def _compute_locked_positions(self): + for record in self: + record.locked_positions = record.state != "draft" + + def action_quotation_send(self): + self.recompute_positions() + return super().action_quotation_send() + + def recompute_positions(self): + self.ensure_one() + if self.locked_positions: + return + lines = self.order_line.filtered(lambda l: not l.display_type) + lines.sorted(key=lambda x: x.sequence) + for position, line in enumerate(lines, start=1): + line.position = position diff --git a/sale_order_line_position/models/sale_order_line.py b/sale_order_line_position/models/sale_order_line.py new file mode 100644 index 000000000..746729629 --- /dev/null +++ b/sale_order_line_position/models/sale_order_line.py @@ -0,0 +1,68 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import api, fields, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + position = fields.Integer(readonly=True, index=True, default=False) + position_formatted = fields.Char(compute="_compute_position_formatted") + + @api.depends("position") + def _compute_position_formatted(self): + for record in self: + record.position_formatted = record._format_position(record.position) + + @api.onchange("sequence") + def _onchange_sequence(self): + if self.order_id.locked_positions: + return + lines = self.order_id.order_line.filtered( + lambda x: not x.display_type and x.sequence < self.sequence + ) + self.position = len(lines) + 1 + + @api.model_create_multi + def create(self, vals_list): + vals_list = self._add_next_position_on_new_line(vals_list) + return super().create(vals_list) + + def unlink(self): + sales = self.mapped("order_id") + res = super().unlink() + for sale in sales: + sale.recompute_positions() + return res + + def _add_next_position_on_new_line(self, vals_list): + sale_ids = [ + line["order_id"] + for line in vals_list + if not line.get("display_type") and line.get("order_id") + ] + if sale_ids: + ids = tuple(set(sale_ids)) + self.flush() + query = """ + SELECT order_id, max(position) FROM sale_order_line + WHERE order_id in %s GROUP BY order_id; + """ + self.env.cr.execute(query, (ids,)) + default_pos = {key: 1 for key in ids} + existing_pos = { + order_id: pos + 1 for order_id, pos in self.env.cr.fetchall() + } + sale_pos = {**default_pos, **existing_pos} + for line in vals_list: + if not line.get("display_type"): + line["position"] = sale_pos[line["order_id"]] + sale_pos[line["order_id"]] += 1 + return vals_list + + @api.model + def _format_position(self, position): + if not position: + return "" + return str(position).zfill(3) diff --git a/sale_order_line_position/readme/CONTRIBUTORS.rst b/sale_order_line_position/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0dd376fae --- /dev/null +++ b/sale_order_line_position/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Thierry Ducrest diff --git a/sale_order_line_position/readme/DESCRIPTION.rst b/sale_order_line_position/readme/DESCRIPTION.rst new file mode 100644 index 000000000..fbf494a0b --- /dev/null +++ b/sale_order_line_position/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +This module adds an auto computed position on sale order line. +This position number is added on the report. + +The position can be used to keep track of each line during +the delivery and invoicing of the order with the customer. +This is why there are related modules on `account-invoice-reporting` +and `stock-logisics-reporting`. + +The position is not changed on the line after the order has been send. diff --git a/sale_order_line_position/readme/ROADMAP.rst b/sale_order_line_position/readme/ROADMAP.rst new file mode 100644 index 000000000..ade3ff206 --- /dev/null +++ b/sale_order_line_position/readme/ROADMAP.rst @@ -0,0 +1,14 @@ +The way the positions are computed on the create of `sale.order.line` +record could lead to a performance issue. There is a few improvements +that have been suggested: + +Remove it and handle the computation on the write and/or create +method of the `sale.order`. + +Have a context key to enable/disable the recomputation. + +Do not set any value in the position fields before the sale order lines +are locked (in the current implementation, before sending). +And add a recompute button in the UI. + +Set the position values with an SQL query using a `TRIGGER`. diff --git a/sale_order_line_position/report/sale_order_report.xml b/sale_order_line_position/report/sale_order_report.xml new file mode 100644 index 000000000..5554a478d --- /dev/null +++ b/sale_order_line_position/report/sale_order_report.xml @@ -0,0 +1,19 @@ + + + + diff --git a/sale_order_line_position/static/description/index.html b/sale_order_line_position/static/description/index.html new file mode 100644 index 000000000..f5a171e64 --- /dev/null +++ b/sale_order_line_position/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +Sale 0rder Line Position + + + +
+

Sale 0rder Line Position

+ + +

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

+

This module adds an auto computed position on sale order line. +This position number is added on the report.

+

The position can be used to keep track of each line during +the delivery and invoicing of the order with the customer. +This is why there are related modules on account-invoice-reporting +and stock-logisics-reporting.

+

The position is not changed on the line after the order has been send.

+

Table of contents

+ +
+

Known issues / Roadmap

+

The way the positions are computed on the create of sale.order.line +record could lead to a performance issue. There is a few improvements +that have been suggested:

+

Remove it and handle the computation on the write and/or create +method of the sale.order.

+

Have a context key to enable/disable the recomputation.

+

Do not set any value in the position fields before the sale order lines +are locked (in the current implementation, before sending). +And add a recompute button in the UI.

+

Set the position values with an SQL query using a TRIGGER.

+
+
+

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

+
    +
  • Camptocamp
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/sale_order_line_position/tests/__init__.py b/sale_order_line_position/tests/__init__.py new file mode 100644 index 000000000..8636f14de --- /dev/null +++ b/sale_order_line_position/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order_line_position diff --git a/sale_order_line_position/tests/test_sale_order_line_position.py b/sale_order_line_position/tests/test_sale_order_line_position.py new file mode 100644 index 000000000..1964611d2 --- /dev/null +++ b/sale_order_line_position/tests/test_sale_order_line_position.py @@ -0,0 +1,82 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo.tests import SavepointCase + + +class TestSaleOrderLinePosition(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.partner = cls.env.ref("base.res_partner_12") + cls.product = cls.env.ref("product.product_product_9") + cls.order = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": cls.product.id, + "product_uom": cls.product.uom_id.id, + "product_uom_qty": 3.0, + }, + ), + (0, 0, {"display_type": "line_section", "name": "Section"}), + ( + 0, + 0, + { + "product_id": cls.product.id, + "product_uom": cls.product.uom_id.id, + "product_uom_qty": 5.0, + }, + ), + ], + } + ) + + def test_new_line_position(self): + """Check that new line created get a new incremental position number.""" + line1 = self.order.order_line[0] + self.assertEqual(line1.position, 1) + self.assertEqual(line1.position_formatted, "001") + line2 = self.order.order_line[1] + self.assertEqual(line2.position, 0) + self.assertEqual(line2.position_formatted, "") + line3 = self.env["sale.order.line"].create( + [ + { + "order_id": self.order.id, + "product_id": self.product.id, + "product_uom": self.product.uom_id.id, + "product_uom_qty": 9.0, + }, + ] + ) + self.assertEqual(line3.position, 3) + self.assertEqual(line3.position_formatted, "003") + + def test_unlink_line(self): + """Check that when line are being removed position are recomputed.""" + self.order.order_line[0].unlink() + self.assertEqual(len(self.order.order_line), 2) + self.assertEqual(self.order.order_line[1].position, 1) + + def test_locked_positions(self): + """Check that when order is sent, position are not recomputed.""" + new_line = self.env["sale.order.line"].create( + [ + { + "order_id": self.order.id, + "product_id": self.product.id, + "product_uom": self.product.uom_id.id, + "product_uom_qty": 15.0, + }, + ] + ) + self.assertEqual(new_line.position, 3) + self.order.state = "sent" + self.order.order_line[0].unlink() + self.assertEqual(new_line.position, 3) diff --git a/sale_order_line_position/views/sale_order.xml b/sale_order_line_position/views/sale_order.xml new file mode 100644 index 000000000..ebe67ddd7 --- /dev/null +++ b/sale_order_line_position/views/sale_order.xml @@ -0,0 +1,23 @@ + + + + sale.order.form.sale.inherit + sale.order + + 100 + + + + + + + + + + From 00c5cd1b217a0c1c76d1e8daa2d6d59057b7dc34 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 17 Sep 2021 14:10:39 +0000 Subject: [PATCH 02/28] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sale_order_line_position/static/description/icon.png diff --git a/sale_order_line_position/static/description/icon.png b/sale_order_line_position/static/description/icon.png new file mode 100644 index 0000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subject: [PATCH 03/28] [MIG] sale_order_line_position: Migration to 14.0 --- sale_order_line_position/README.rst | 17 +++++++++++----- sale_order_line_position/__manifest__.py | 2 +- .../i18n/sale_order_line_position.pot | 20 ++++++++++++++++++- .../readme/CONTRIBUTORS.rst | 2 ++ sale_order_line_position/readme/CREDITS.rst | 1 + .../static/description/index.html | 17 +++++++++++----- 6 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 sale_order_line_position/readme/CREDITS.rst diff --git a/sale_order_line_position/README.rst b/sale_order_line_position/README.rst index 4210d2a0f..b8be2e7a2 100644 --- a/sale_order_line_position/README.rst +++ b/sale_order_line_position/README.rst @@ -14,13 +14,13 @@ Sale 0rder Line Position :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--reporting-lightgray.png?logo=github - :target: https://github.com/OCA/sale-reporting/tree/13.0/sale_order_line_position + :target: https://github.com/OCA/sale-reporting/tree/14.0/sale_order_line_position :alt: OCA/sale-reporting .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/sale-reporting-13-0/sale-reporting-13-0-sale_order_line_position + :target: https://translation.odoo-community.org/projects/sale-reporting-14-0/sale-reporting-14-0-sale_order_line_position :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/148/13.0 + :target: https://runbot.odoo-community.org/runbot/148/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -64,7 +64,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -80,6 +80,13 @@ Contributors ~~~~~~~~~~~~ * Thierry Ducrest +* `Trobz `_: +* Nguyen Hoang Hiep + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp Maintainers ~~~~~~~~~~~ @@ -94,6 +101,6 @@ 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-reporting `_ project on GitHub. +This module is part of the `OCA/sale-reporting `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index 3040c7a00..037c7d609 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale 0rder Line Position", "summary": "Adds position number on sale order line.", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "category": "Sales", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot index 17e678cc5..f1767670d 100644 --- a/sale_order_line_position/i18n/sale_order_line_position.pot +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -13,6 +13,24 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name +msgid "Display Name" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id +msgid "ID" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update +msgid "Last Modified on" +msgstr "" + #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" diff --git a/sale_order_line_position/readme/CONTRIBUTORS.rst b/sale_order_line_position/readme/CONTRIBUTORS.rst index 0dd376fae..1e51756c8 100644 --- a/sale_order_line_position/readme/CONTRIBUTORS.rst +++ b/sale_order_line_position/readme/CONTRIBUTORS.rst @@ -1 +1,3 @@ * Thierry Ducrest +* `Trobz `_: +* Nguyen Hoang Hiep diff --git a/sale_order_line_position/readme/CREDITS.rst b/sale_order_line_position/readme/CREDITS.rst new file mode 100644 index 000000000..f37ebe757 --- /dev/null +++ b/sale_order_line_position/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp diff --git a/sale_order_line_position/static/description/index.html b/sale_order_line_position/static/description/index.html index f5a171e64..54e292624 100644 --- a/sale_order_line_position/static/description/index.html +++ b/sale_order_line_position/static/description/index.html @@ -367,7 +367,7 @@

Sale 0rder Line Position

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module adds an auto computed position on sale order line. This position number is added on the report.

The position can be used to keep track of each line during @@ -383,7 +383,8 @@

Sale 0rder Line Position

  • Credits
  • @@ -406,7 +407,7 @@

    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.

    +feedback.

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

    @@ -421,16 +422,22 @@

    Authors

    Contributors

    +
    +

    Other credits

    +

    The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

    +
    -

    Maintainers

    +

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

    +

    This module is part of the OCA/sale-reporting project on GitHub.

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

    From b56566b60bed138e59f9ae9a878a3e8f2a3c8f58 Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Mon, 11 Oct 2021 10:46:58 +0200 Subject: [PATCH 04/28] [13.0][FIX] sale-order-line-position The previous implementation with the onchange was broken and hardly feasible (onchange are called on each line and the sequence set on them changes on each call) and not possible to cover with unit tests (reproduce the drag and drop). The other solution could have been to replace the onchange with a recompute of the position on every `write` of a sale.order but that also leads to a complex solution. As the positions are needed to discuss with the customer, the recompute of the position on print, send and confirm is a good enough, simple solution. --- sale_order_line_position/README.rst | 9 +++++++-- .../i18n/sale_order_line_position.pot | 13 +++++++++++++ sale_order_line_position/models/__init__.py | 1 + .../models/ir_actions_report.py | 17 +++++++++++++++++ sale_order_line_position/models/sale_order.py | 18 +++++++++++------- .../models/sale_order_line.py | 9 --------- .../readme/DESCRIPTION.rst | 9 +++++++-- .../static/description/index.html | 7 +++++-- sale_order_line_position/views/sale_order.xml | 12 ++++++++++++ 9 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 sale_order_line_position/models/ir_actions_report.py diff --git a/sale_order_line_position/README.rst b/sale_order_line_position/README.rst index b8be2e7a2..ccd7be124 100644 --- a/sale_order_line_position/README.rst +++ b/sale_order_line_position/README.rst @@ -26,14 +26,19 @@ Sale 0rder Line Position |badge1| |badge2| |badge3| |badge4| |badge5| This module adds an auto computed position on sale order line. -This position number is added on the report. +This position number is also printed on the report. The position can be used to keep track of each line during the delivery and invoicing of the order with the customer. This is why there are related modules on `account-invoice-reporting` and `stock-logisics-reporting`. -The position is not changed on the line after the order has been send. +The positions are recomputed when the sale order is printed, sent and set to confirm. + +The positions are not changed on the line after the order has been confirmed, but if +new line are added they will receive a position number. + +An action is also availabled to manually recompute the positions. **Table of contents** diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot index f1767670d..a45a79082 100644 --- a/sale_order_line_position/i18n/sale_order_line_position.pot +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -14,18 +14,21 @@ msgstr "" "Plural-Forms: \n" #. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__display_name #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name msgid "Display Name" msgstr "" #. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__id #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id msgid "ID" msgstr "" #. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report____last_update #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update msgid "Last Modified on" @@ -52,6 +55,16 @@ msgstr "" msgid "Position Formatted" msgstr "" +#. module: sale_order_line_position +#: model:ir.actions.server,name:sale_order_line_position.action_compute_sale_position +msgid "Recompute positions" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_ir_actions_report +msgid "Report Action" +msgstr "" + #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" diff --git a/sale_order_line_position/models/__init__.py b/sale_order_line_position/models/__init__.py index 2d7ee6c3d..fca7f1ced 100644 --- a/sale_order_line_position/models/__init__.py +++ b/sale_order_line_position/models/__init__.py @@ -1,2 +1,3 @@ +from . import ir_actions_report from . import sale_order from . import sale_order_line diff --git a/sale_order_line_position/models/ir_actions_report.py b/sale_order_line_position/models/ir_actions_report.py new file mode 100644 index 000000000..0c0cf2a98 --- /dev/null +++ b/sale_order_line_position/models/ir_actions_report.py @@ -0,0 +1,17 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import models + + +class IrActionsReport(models.Model): + _inherit = "ir.actions.report" + + def render_qweb_pdf(self, res_ids=None, data=None): + self.sale_recompute_positions(res_ids) + return super().render_qweb_pdf(res_ids, data) + + def sale_recompute_positions(self, res_ids): + if self.model == "sale.order": + sales = self.env["sale.order"].browse(res_ids) + sales.recompute_positions() diff --git a/sale_order_line_position/models/sale_order.py b/sale_order_line_position/models/sale_order.py index 3e8c073b1..469ca2aa7 100644 --- a/sale_order_line_position/models/sale_order.py +++ b/sale_order_line_position/models/sale_order.py @@ -14,15 +14,19 @@ def _compute_locked_positions(self): for record in self: record.locked_positions = record.state != "draft" + def action_confirm(self): + self.recompute_positions() + return super().action_confirm() + def action_quotation_send(self): self.recompute_positions() return super().action_quotation_send() def recompute_positions(self): - self.ensure_one() - if self.locked_positions: - return - lines = self.order_line.filtered(lambda l: not l.display_type) - lines.sorted(key=lambda x: x.sequence) - for position, line in enumerate(lines, start=1): - line.position = position + for sale in self: + if sale.locked_positions: + continue + lines = sale.order_line.filtered(lambda l: not l.display_type) + lines.sorted(key=lambda x: (x.sequence, x.id)) + for position, line in enumerate(lines, start=1): + line.position = position diff --git a/sale_order_line_position/models/sale_order_line.py b/sale_order_line_position/models/sale_order_line.py index 746729629..f9b22b79a 100644 --- a/sale_order_line_position/models/sale_order_line.py +++ b/sale_order_line_position/models/sale_order_line.py @@ -15,15 +15,6 @@ def _compute_position_formatted(self): for record in self: record.position_formatted = record._format_position(record.position) - @api.onchange("sequence") - def _onchange_sequence(self): - if self.order_id.locked_positions: - return - lines = self.order_id.order_line.filtered( - lambda x: not x.display_type and x.sequence < self.sequence - ) - self.position = len(lines) + 1 - @api.model_create_multi def create(self, vals_list): vals_list = self._add_next_position_on_new_line(vals_list) diff --git a/sale_order_line_position/readme/DESCRIPTION.rst b/sale_order_line_position/readme/DESCRIPTION.rst index fbf494a0b..13f06343b 100644 --- a/sale_order_line_position/readme/DESCRIPTION.rst +++ b/sale_order_line_position/readme/DESCRIPTION.rst @@ -1,9 +1,14 @@ This module adds an auto computed position on sale order line. -This position number is added on the report. +This position number is also printed on the report. The position can be used to keep track of each line during the delivery and invoicing of the order with the customer. This is why there are related modules on `account-invoice-reporting` and `stock-logisics-reporting`. -The position is not changed on the line after the order has been send. +The positions are recomputed when the sale order is printed, sent and set to confirm. + +The positions are not changed on the line after the order has been confirmed, but if +new line are added they will receive a position number. + +An action is also availabled to manually recompute the positions. diff --git a/sale_order_line_position/static/description/index.html b/sale_order_line_position/static/description/index.html index 54e292624..4d9b5813d 100644 --- a/sale_order_line_position/static/description/index.html +++ b/sale_order_line_position/static/description/index.html @@ -369,12 +369,15 @@

    Sale 0rder Line Position

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

    This module adds an auto computed position on sale order line. -This position number is added on the report.

    +This position number is also printed on the report.

    The position can be used to keep track of each line during the delivery and invoicing of the order with the customer. This is why there are related modules on account-invoice-reporting and stock-logisics-reporting.

    -

    The position is not changed on the line after the order has been send.

    +

    The positions are recomputed when the sale order is printed, sent and set to confirm.

    +

    The positions are not changed on the line after the order has been confirmed, but if +new line are added they will receive a position number.

    +

    An action is also availabled to manually recompute the positions.

    Table of contents

      diff --git a/sale_order_line_position/views/sale_order.xml b/sale_order_line_position/views/sale_order.xml index ebe67ddd7..f485eebc3 100644 --- a/sale_order_line_position/views/sale_order.xml +++ b/sale_order_line_position/views/sale_order.xml @@ -1,5 +1,6 @@ + sale.order.form.sale.inherit sale.order @@ -20,4 +21,15 @@ + + + Recompute positions + + + code + + records.recompute_positions() + + + From 395fdc348fda79f27bde4f623b07ed393b88386d Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 17 Jan 2022 14:37:15 +0000 Subject: [PATCH 05/28] sale_order_line_position 14.0.1.1.0 --- sale_order_line_position/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index 037c7d609..ad72a7884 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale 0rder Line Position", "summary": "Adds position number on sale order line.", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "category": "Sales", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", From 90d767578d5202eb72fd3217a6c535993e6809f0 Mon Sep 17 00:00:00 2001 From: Maria Sparenberg Date: Wed, 11 May 2022 10:07:21 +0000 Subject: [PATCH 06/28] Added translation using Weblate (German) --- sale_order_line_position/i18n/de.po | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sale_order_line_position/i18n/de.po diff --git a/sale_order_line_position/i18n/de.po b/sale_order_line_position/i18n/de.po new file mode 100644 index 000000000..d3107c7be --- /dev/null +++ b/sale_order_line_position/i18n/de.po @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__display_name +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name +msgid "Display Name" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__id +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id +msgid "ID" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report____last_update +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions +msgid "Locked Positions" +msgstr "" + +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.report_saleorder_document +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.view_order_form_inherit +msgid "Pos" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position +msgid "Position" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position_formatted +msgid "Position Formatted" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.actions.server,name:sale_order_line_position.action_compute_sale_position +msgid "Recompute positions" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_ir_actions_report +msgid "Report Action" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order_line +msgid "Sales Order Line" +msgstr "" From 77d4a7a86be0191c7a99c99858f3ed17aadf2bcc Mon Sep 17 00:00:00 2001 From: Maria Sparenberg Date: Wed, 11 May 2022 10:10:51 +0000 Subject: [PATCH 07/28] Translated using Weblate (German) Currently translated at 81.8% (9 of 11 strings) Translation: sale-reporting-14.0/sale-reporting-14.0-sale_order_line_position Translate-URL: https://translation.odoo-community.org/projects/sale-reporting-14-0/sale-reporting-14-0-sale_order_line_position/de/ --- sale_order_line_position/i18n/de.po | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sale_order_line_position/i18n/de.po b/sale_order_line_position/i18n/de.po index d3107c7be..17570a58a 100644 --- a/sale_order_line_position/i18n/de.po +++ b/sale_order_line_position/i18n/de.po @@ -6,50 +6,52 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-05-11 12:05+0000\n" +"Last-Translator: Maria Sparenberg \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 4.3.2\n" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__display_name #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name msgid "Display Name" -msgstr "" +msgstr "Anzeigename" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__id #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id msgid "ID" -msgstr "" +msgstr "ID" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report____last_update #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update msgid "Last Modified on" -msgstr "" +msgstr "Zuletzt geändert am" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" -msgstr "" +msgstr "Gesperrte Positionen" #. module: sale_order_line_position #: model_terms:ir.ui.view,arch_db:sale_order_line_position.report_saleorder_document #: model_terms:ir.ui.view,arch_db:sale_order_line_position.view_order_form_inherit msgid "Pos" -msgstr "" +msgstr "Pos" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position msgid "Position" -msgstr "" +msgstr "Position" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position_formatted @@ -59,7 +61,7 @@ msgstr "" #. module: sale_order_line_position #: model:ir.actions.server,name:sale_order_line_position.action_compute_sale_position msgid "Recompute positions" -msgstr "" +msgstr "Positionen neuberechnen" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_ir_actions_report @@ -69,9 +71,9 @@ msgstr "" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" -msgstr "" +msgstr "Verkaufsauftrag" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order_line msgid "Sales Order Line" -msgstr "" +msgstr "Auftragsposition" From ee32db3e171ce4bcff7207cb5043877e16efd368 Mon Sep 17 00:00:00 2001 From: Anna Janiszewska Date: Thu, 12 May 2022 09:02:15 +0200 Subject: [PATCH 08/28] [MIG] sale_order_line_position : Migration to 15.0 --- sale_order_line_position/README.rst | 10 ++++---- sale_order_line_position/__manifest__.py | 2 +- .../i18n/sale_order_line_position.pot | 23 +------------------ .../static/description/index.html | 6 ++--- .../tests/test_sale_order_line_position.py | 4 ++-- 5 files changed, 12 insertions(+), 33 deletions(-) diff --git a/sale_order_line_position/README.rst b/sale_order_line_position/README.rst index ccd7be124..633de5a0c 100644 --- a/sale_order_line_position/README.rst +++ b/sale_order_line_position/README.rst @@ -14,13 +14,13 @@ Sale 0rder Line Position :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--reporting-lightgray.png?logo=github - :target: https://github.com/OCA/sale-reporting/tree/14.0/sale_order_line_position + :target: https://github.com/OCA/sale-reporting/tree/15.0/sale_order_line_position :alt: OCA/sale-reporting .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/sale-reporting-14-0/sale-reporting-14-0-sale_order_line_position + :target: https://translation.odoo-community.org/projects/sale-reporting-15-0/sale-reporting-15-0-sale_order_line_position :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/148/14.0 + :target: https://runbot.odoo-community.org/runbot/148/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -69,7 +69,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -106,6 +106,6 @@ 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-reporting `_ project on GitHub. +This module is part of the `OCA/sale-reporting `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index ad72a7884..4a9490b74 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale 0rder Line Position", "summary": "Adds position number on sale order line.", - "version": "14.0.1.1.0", + "version": "15.0.1.0.0", "category": "Sales", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot index a45a79082..2efc38d81 100644 --- a/sale_order_line_position/i18n/sale_order_line_position.pot +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -13,27 +13,6 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__display_name -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name -msgid "Display Name" -msgstr "" - -#. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__id -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id -msgid "ID" -msgstr "" - -#. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report____last_update -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update -msgid "Last Modified on" -msgstr "" - #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" diff --git a/sale_order_line_position/static/description/index.html b/sale_order_line_position/static/description/index.html index 4d9b5813d..190a1ca72 100644 --- a/sale_order_line_position/static/description/index.html +++ b/sale_order_line_position/static/description/index.html @@ -367,7 +367,7 @@

      Sale 0rder Line Position

      !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

      +

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

      This module adds an auto computed position on sale order line. This position number is also printed on the report.

      The position can be used to keep track of each line during @@ -410,7 +410,7 @@

      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.

      +feedback.

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

    @@ -440,7 +440,7 @@

    Maintainers

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

    +

    This module is part of the OCA/sale-reporting project on GitHub.

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

    diff --git a/sale_order_line_position/tests/test_sale_order_line_position.py b/sale_order_line_position/tests/test_sale_order_line_position.py index 1964611d2..d0375a673 100644 --- a/sale_order_line_position/tests/test_sale_order_line_position.py +++ b/sale_order_line_position/tests/test_sale_order_line_position.py @@ -1,9 +1,9 @@ # Copyright 2021 Camptocamp SA # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) -from odoo.tests import SavepointCase +from odoo.tests import TransactionCase -class TestSaleOrderLinePosition(SavepointCase): +class TestSaleOrderLinePosition(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() From 57281bd3dfe03959585740e62649f6bacd8d2d73 Mon Sep 17 00:00:00 2001 From: Anna Janiszewska Date: Mon, 16 May 2022 16:22:40 +0200 Subject: [PATCH 09/28] [IMP] sale_order_line_position: allow to disable position recomputing --- sale_order_line_position/__manifest__.py | 6 +++- sale_order_line_position/models/__init__.py | 2 ++ .../models/res_company.py | 12 +++++++ .../models/res_config_settings.py | 13 ++++++++ sale_order_line_position/models/sale_order.py | 2 +- .../tests/test_sale_order_line_position.py | 8 +++++ .../views/res_config_settings.xml | 32 +++++++++++++++++++ 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 sale_order_line_position/models/res_company.py create mode 100644 sale_order_line_position/models/res_config_settings.py create mode 100644 sale_order_line_position/views/res_config_settings.xml diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index 4a9490b74..c8d72d535 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -10,6 +10,10 @@ "license": "AGPL-3", "website": "https://github.com/OCA/sale-reporting", "depends": ["sale"], - "data": ["views/sale_order.xml", "report/sale_order_report.xml"], + "data": [ + "views/sale_order.xml", + "views/res_config_settings.xml", + "report/sale_order_report.xml", + ], "installable": True, } diff --git a/sale_order_line_position/models/__init__.py b/sale_order_line_position/models/__init__.py index fca7f1ced..d5eab7173 100644 --- a/sale_order_line_position/models/__init__.py +++ b/sale_order_line_position/models/__init__.py @@ -1,3 +1,5 @@ from . import ir_actions_report from . import sale_order from . import sale_order_line +from . import res_company +from . import res_config_settings diff --git a/sale_order_line_position/models/res_company.py b/sale_order_line_position/models/res_company.py new file mode 100644 index 000000000..345fbdfb3 --- /dev/null +++ b/sale_order_line_position/models/res_company.py @@ -0,0 +1,12 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + disable_sale_position_recompute = fields.Boolean( + string="Do not recompute positions on sale orders" + ) diff --git a/sale_order_line_position/models/res_config_settings.py b/sale_order_line_position/models/res_config_settings.py new file mode 100644 index 000000000..cf228b954 --- /dev/null +++ b/sale_order_line_position/models/res_config_settings.py @@ -0,0 +1,13 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + disable_sale_position_recompute = fields.Boolean( + related="company_id.disable_sale_position_recompute", + readonly=False, + ) diff --git a/sale_order_line_position/models/sale_order.py b/sale_order_line_position/models/sale_order.py index 469ca2aa7..6dff4fa64 100644 --- a/sale_order_line_position/models/sale_order.py +++ b/sale_order_line_position/models/sale_order.py @@ -24,7 +24,7 @@ def action_quotation_send(self): def recompute_positions(self): for sale in self: - if sale.locked_positions: + if sale.locked_positions or sale.company_id.disable_sale_position_recompute: continue lines = sale.order_line.filtered(lambda l: not l.display_type) lines.sorted(key=lambda x: (x.sequence, x.id)) diff --git a/sale_order_line_position/tests/test_sale_order_line_position.py b/sale_order_line_position/tests/test_sale_order_line_position.py index d0375a673..d273fa348 100644 --- a/sale_order_line_position/tests/test_sale_order_line_position.py +++ b/sale_order_line_position/tests/test_sale_order_line_position.py @@ -64,6 +64,14 @@ def test_unlink_line(self): self.assertEqual(len(self.order.order_line), 2) self.assertEqual(self.order.order_line[1].position, 1) + def test_unlink_no_recompute_line(self): + """Check that when parameter disable_sale_position_recompute is True + and line are being removed position are not recomputed.""" + self.order.company_id.disable_sale_position_recompute = True + self.order.order_line[0].unlink() + self.assertEqual(len(self.order.order_line), 2) + self.assertEqual(self.order.order_line[1].position, 2) + def test_locked_positions(self): """Check that when order is sent, position are not recomputed.""" new_line = self.env["sale.order.line"].create( diff --git a/sale_order_line_position/views/res_config_settings.xml b/sale_order_line_position/views/res_config_settings.xml new file mode 100644 index 000000000..19eb85e6b --- /dev/null +++ b/sale_order_line_position/views/res_config_settings.xml @@ -0,0 +1,32 @@ + + + + sale.config.positioning.form + res.config.settings + + +
    +

    Sale Order Line Positions

    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    From b9681308951ce75fc5c9050ce3f7a3a855fde467 Mon Sep 17 00:00:00 2001 From: jabelchi Date: Fri, 3 Jun 2022 07:44:40 +0000 Subject: [PATCH 10/28] Added translation using Weblate (Catalan) --- sale_order_line_position/i18n/ca.po | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sale_order_line_position/i18n/ca.po diff --git a/sale_order_line_position/i18n/ca.po b/sale_order_line_position/i18n/ca.po new file mode 100644 index 000000000..a45ef1d45 --- /dev/null +++ b/sale_order_line_position/i18n/ca.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ca\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" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions +msgid "Locked Positions" +msgstr "" + +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.report_saleorder_document +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.view_order_form_inherit +msgid "Pos" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position +msgid "Position" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position_formatted +msgid "Position Formatted" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.actions.server,name:sale_order_line_position.action_compute_sale_position +msgid "Recompute positions" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_ir_actions_report +msgid "Report Action" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_sale_order_line +msgid "Sales Order Line" +msgstr "" From f4c4d61bf1a4d941a1b9108064a0734a92bedf16 Mon Sep 17 00:00:00 2001 From: jabelchi Date: Fri, 3 Jun 2022 07:46:53 +0000 Subject: [PATCH 11/28] Translated using Weblate (Catalan) Currently translated at 100.0% (8 of 8 strings) Translation: sale-reporting-15.0/sale-reporting-15.0-sale_order_line_position Translate-URL: https://translation.odoo-community.org/projects/sale-reporting-15-0/sale-reporting-15-0-sale_order_line_position/ca/ --- sale_order_line_position/i18n/ca.po | 20 +++++++------- .../i18n/sale_order_line_position.pot | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/sale_order_line_position/i18n/ca.po b/sale_order_line_position/i18n/ca.po index a45ef1d45..60116e3de 100644 --- a/sale_order_line_position/i18n/ca.po +++ b/sale_order_line_position/i18n/ca.po @@ -6,51 +6,53 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-06-03 10:05+0000\n" +"Last-Translator: jabelchi \n" "Language-Team: none\n" "Language: ca\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 4.3.2\n" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" -msgstr "" +msgstr "Posicions bloquejades" #. module: sale_order_line_position #: model_terms:ir.ui.view,arch_db:sale_order_line_position.report_saleorder_document #: model_terms:ir.ui.view,arch_db:sale_order_line_position.view_order_form_inherit msgid "Pos" -msgstr "" +msgstr "Pos" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position msgid "Position" -msgstr "" +msgstr "Posició" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__position_formatted msgid "Position Formatted" -msgstr "" +msgstr "Posició formatada" #. module: sale_order_line_position #: model:ir.actions.server,name:sale_order_line_position.action_compute_sale_position msgid "Recompute positions" -msgstr "" +msgstr "Recalcula posicions" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_ir_actions_report msgid "Report Action" -msgstr "" +msgstr "Acció d'informe" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" -msgstr "" +msgstr "Comanda de venda" #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order_line msgid "Sales Order Line" -msgstr "" +msgstr "Línia de comanda de venda" diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot index 2efc38d81..36fc38120 100644 --- a/sale_order_line_position/i18n/sale_order_line_position.pot +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -13,6 +13,27 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_res_company +msgid "Companies" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_company__disable_sale_position_recompute +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_config_settings__disable_sale_position_recompute +msgid "Do not recompute positions on sale orders" +msgstr "" + +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Do not recompute positions when line is removed" +msgstr "" + #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" @@ -44,6 +65,11 @@ msgstr "" msgid "Report Action" msgstr "" +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Sale Order Line Positions" +msgstr "" + #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" From 1c08d6fa1a8155cab2e99540850db38823c3dbfd Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 6 Jul 2022 08:39:38 +0000 Subject: [PATCH 12/28] sale_order_line_position 15.0.1.1.0 --- sale_order_line_position/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index c8d72d535..b3a753243 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale 0rder Line Position", "summary": "Adds position number on sale order line.", - "version": "15.0.1.0.0", + "version": "15.0.1.1.0", "category": "Sales", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", From 60bf0011c679d56324bcfc980226ce7fa3c31456 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Wed, 6 Jul 2022 08:39:43 +0000 Subject: [PATCH 13/28] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-reporting-15.0/sale-reporting-15.0-sale_order_line_position Translate-URL: https://translation.odoo-community.org/projects/sale-reporting-15-0/sale-reporting-15-0-sale_order_line_position/ --- sale_order_line_position/i18n/ca.po | 26 +++++++++++++++++ sale_order_line_position/i18n/de.po | 44 +++++++++++++++++++---------- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/sale_order_line_position/i18n/ca.po b/sale_order_line_position/i18n/ca.po index 60116e3de..c3db54f0e 100644 --- a/sale_order_line_position/i18n/ca.po +++ b/sale_order_line_position/i18n/ca.po @@ -16,6 +16,27 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.3.2\n" +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_res_company +msgid "Companies" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_company__disable_sale_position_recompute +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_config_settings__disable_sale_position_recompute +msgid "Do not recompute positions on sale orders" +msgstr "" + +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Do not recompute positions when line is removed" +msgstr "" + #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions msgid "Locked Positions" @@ -47,6 +68,11 @@ msgstr "Recalcula posicions" msgid "Report Action" msgstr "Acció d'informe" +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Sale Order Line Positions" +msgstr "" + #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" diff --git a/sale_order_line_position/i18n/de.po b/sale_order_line_position/i18n/de.po index 17570a58a..c780967a0 100644 --- a/sale_order_line_position/i18n/de.po +++ b/sale_order_line_position/i18n/de.po @@ -17,25 +17,25 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__display_name -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__display_name -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__display_name -msgid "Display Name" -msgstr "Anzeigename" +#: model:ir.model,name:sale_order_line_position.model_res_company +msgid "Companies" +msgstr "" + +#. module: sale_order_line_position +#: model:ir.model,name:sale_order_line_position.model_res_config_settings +msgid "Config Settings" +msgstr "" #. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report__id -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__id -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line__id -msgid "ID" -msgstr "ID" +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_company__disable_sale_position_recompute +#: model:ir.model.fields,field_description:sale_order_line_position.field_res_config_settings__disable_sale_position_recompute +msgid "Do not recompute positions on sale orders" +msgstr "" #. module: sale_order_line_position -#: model:ir.model.fields,field_description:sale_order_line_position.field_ir_actions_report____last_update -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order____last_update -#: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order_line____last_update -msgid "Last Modified on" -msgstr "Zuletzt geändert am" +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Do not recompute positions when line is removed" +msgstr "" #. module: sale_order_line_position #: model:ir.model.fields,field_description:sale_order_line_position.field_sale_order__locked_positions @@ -68,6 +68,11 @@ msgstr "Positionen neuberechnen" msgid "Report Action" msgstr "" +#. module: sale_order_line_position +#: model_terms:ir.ui.view,arch_db:sale_order_line_position.res_config_settings_view_form +msgid "Sale Order Line Positions" +msgstr "" + #. module: sale_order_line_position #: model:ir.model,name:sale_order_line_position.model_sale_order msgid "Sales Order" @@ -77,3 +82,12 @@ msgstr "Verkaufsauftrag" #: model:ir.model,name:sale_order_line_position.model_sale_order_line msgid "Sales Order Line" msgstr "Auftragsposition" + +#~ msgid "Display Name" +#~ msgstr "Anzeigename" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Zuletzt geändert am" From fe8a857263bdfa1181d0d9b7149d66ce0e38ddf1 Mon Sep 17 00:00:00 2001 From: Anna Janiszewska Date: Mon, 23 Jan 2023 15:49:16 +0100 Subject: [PATCH 14/28] [MIG] sale_order_line_position: Migration to 16.0 --- sale_order_line_position/README.rst | 23 ++++++---- sale_order_line_position/__manifest__.py | 2 +- .../i18n/sale_order_line_position.pot | 2 +- .../static/description/index.html | 46 ++++++++++--------- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/sale_order_line_position/README.rst b/sale_order_line_position/README.rst index 633de5a0c..d7d43025d 100644 --- a/sale_order_line_position/README.rst +++ b/sale_order_line_position/README.rst @@ -2,10 +2,13 @@ Sale 0rder Line Position ======================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bad0176b2e6beecfbcf3f1bd7dcc99db8178498b9fec3ad6bc81d940ba6f544c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -14,16 +17,16 @@ Sale 0rder Line Position :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--reporting-lightgray.png?logo=github - :target: https://github.com/OCA/sale-reporting/tree/15.0/sale_order_line_position + :target: https://github.com/OCA/sale-reporting/tree/16.0/sale_order_line_position :alt: OCA/sale-reporting .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/sale-reporting-15-0/sale-reporting-15-0-sale_order_line_position + :target: https://translation.odoo-community.org/projects/sale-reporting-16-0/sale-reporting-16-0-sale_order_line_position :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/148/15.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-reporting&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module adds an auto computed position on sale order line. This position number is also printed on the report. @@ -68,8 +71,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 `_. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -106,6 +109,6 @@ 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-reporting `_ project on GitHub. +This module is part of the `OCA/sale-reporting `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_line_position/__manifest__.py b/sale_order_line_position/__manifest__.py index b3a753243..b30cbfbe5 100644 --- a/sale_order_line_position/__manifest__.py +++ b/sale_order_line_position/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale 0rder Line Position", "summary": "Adds position number on sale order line.", - "version": "15.0.1.1.0", + "version": "16.0.1.1.0", "category": "Sales", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/sale_order_line_position/i18n/sale_order_line_position.pot b/sale_order_line_position/i18n/sale_order_line_position.pot index 36fc38120..868ef2754 100644 --- a/sale_order_line_position/i18n/sale_order_line_position.pot +++ b/sale_order_line_position/i18n/sale_order_line_position.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/sale_order_line_position/static/description/index.html b/sale_order_line_position/static/description/index.html index 190a1ca72..ea55edc8b 100644 --- a/sale_order_line_position/static/description/index.html +++ b/sale_order_line_position/static/description/index.html @@ -1,20 +1,20 @@ - + - + Sale 0rder Line Position -
    -

    Sale 0rder Line Position

    +
    +

    Sale Order Line Position

    Beta License: AGPL-3 OCA/sale-reporting Translate me on Weblate Try me on Runboat

    This module adds an auto computed position on sale order line. This diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml new file mode 100644 index 000000000..7b3ac292c --- /dev/null +++ b/setup/_metapackage/pyproject.toml @@ -0,0 +1,11 @@ +[project] +name = "odoo-addons-oca-sale-reporting" +version = "18.0.20241220.0" +dependencies = [ + "odoo-addon-sale_order_line_position==18.0.*", +] +classifiers=[ + "Programming Language :: Python", + "Framework :: Odoo", + "Framework :: Odoo :: 18.0", +]