diff --git a/product_lot_sequence/README.rst b/product_lot_sequence/README.rst index 6d3580fc5bcc..dfcf87c2f2c4 100644 --- a/product_lot_sequence/README.rst +++ b/product_lot_sequence/README.rst @@ -7,7 +7,7 @@ Product Lot Sequence !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:043a59e32b82ffdcafdd494fdb97e28127e8489913d173aefed770e79efc18ce + !! source digest: sha256:b40154ba5f1de85d89cb1c8da85a999bd0cd850538e477e4eb0d9a7272af0bbd !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -38,6 +38,9 @@ Adds ability to define a lot sequence from the product which will be proposed up Configuration ============= +Lot Sequence policy +~~~~~~~~~~~~~~~~~~~ + There are two ways you can configure this module through the use of System Parameter `product_lot_sequence.policy`: @@ -52,6 +55,12 @@ If any other value is used for this System Parameter, then you will get the defa behaviour from odoo 15.0 which will look for the last lot number for each product and will increment it. +Default Number of Digits for Product Sequence Generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The default is 7 digits. To change that to something else, go to the inventory +configuration, find "Sequence Number of Digits" and change the number. + Usage ===== @@ -103,6 +112,9 @@ Contributors * Adria Gil Sorribes * Domantas Girdžiūnas * Akim Juillerat +* `Quartile `__: + + * Yoshi Tashiro Maintainers ~~~~~~~~~~~ diff --git a/product_lot_sequence/__manifest__.py b/product_lot_sequence/__manifest__.py index f3a8ae7683ba..b9f73a8ddcb7 100644 --- a/product_lot_sequence/__manifest__.py +++ b/product_lot_sequence/__manifest__.py @@ -10,5 +10,9 @@ "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "website": "https://github.com/OCA/product-attribute", "depends": ["stock"], - "data": ["data/ir_config_parameter.xml", "views/product_views.xml"], + "data": [ + "data/ir_config_parameter.xml", + "views/product_views.xml", + "views/res_config_settings_views.xml", + ], } diff --git a/product_lot_sequence/models/__init__.py b/product_lot_sequence/models/__init__.py index 9bfdbf927d8a..91f6c7dbdbdf 100644 --- a/product_lot_sequence/models/__init__.py +++ b/product_lot_sequence/models/__init__.py @@ -1,3 +1,5 @@ +from . import res_company +from . import res_config_settings from . import product from . import stock_production_lot from . import stock_move diff --git a/product_lot_sequence/models/product.py b/product_lot_sequence/models/product.py index 414e0c31dd5b..b1c0b0d1f3ab 100644 --- a/product_lot_sequence/models/product.py +++ b/product_lot_sequence/models/product.py @@ -19,7 +19,7 @@ class ProductTemplate(models.Model): ) lot_sequence_padding = fields.Integer( string="Sequence Number of Digits", - default=7, + default=lambda self: self.env.company.lot_sequence_padding, help="The lots' sequence will be created using this number of digits.", ) lot_sequence_number_next = fields.Integer( @@ -32,6 +32,7 @@ class ProductTemplate(models.Model): compute="_compute_display_lot_sequence_fields" ) + @api.depends("tracking") # For products being created (before saved). def _compute_display_lot_sequence_fields(self): self.display_lot_sequence_fields = ( self.env["stock.production.lot"]._get_sequence_policy() == "product" diff --git a/product_lot_sequence/models/res_company.py b/product_lot_sequence/models/res_company.py new file mode 100644 index 000000000000..906a104f88d4 --- /dev/null +++ b/product_lot_sequence/models/res_company.py @@ -0,0 +1,10 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + lot_sequence_padding = fields.Integer("Sequence Number of Digits", default=7) diff --git a/product_lot_sequence/models/res_config_settings.py b/product_lot_sequence/models/res_config_settings.py new file mode 100644 index 000000000000..ad33ee2d4484 --- /dev/null +++ b/product_lot_sequence/models/res_config_settings.py @@ -0,0 +1,13 @@ +# Copyright 2023 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + lot_sequence_padding = fields.Integer( + related="company_id.lot_sequence_padding", + readonly=False, + ) diff --git a/product_lot_sequence/readme/CONFIGURE.rst b/product_lot_sequence/readme/CONFIGURE.rst index ceb059182810..5352001e24a2 100644 --- a/product_lot_sequence/readme/CONFIGURE.rst +++ b/product_lot_sequence/readme/CONFIGURE.rst @@ -1,3 +1,6 @@ +Lot Sequence policy +~~~~~~~~~~~~~~~~~~~ + There are two ways you can configure this module through the use of System Parameter `product_lot_sequence.policy`: @@ -11,3 +14,9 @@ There are two ways you can configure this module through the use of System Param If any other value is used for this System Parameter, then you will get the default behaviour from odoo 15.0 which will look for the last lot number for each product and will increment it. + +Default Number of Digits for Product Sequence Generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The default is 7 digits. To change that to something else, go to the inventory +configuration, find "Sequence Number of Digits" and change the number. diff --git a/product_lot_sequence/readme/CONTRIBUTORS.rst b/product_lot_sequence/readme/CONTRIBUTORS.rst index 087bffc2377e..8248c18a690d 100644 --- a/product_lot_sequence/readme/CONTRIBUTORS.rst +++ b/product_lot_sequence/readme/CONTRIBUTORS.rst @@ -1,3 +1,6 @@ * Adria Gil Sorribes * Domantas Girdžiūnas * Akim Juillerat +* `Quartile `__: + + * Yoshi Tashiro diff --git a/product_lot_sequence/static/description/index.html b/product_lot_sequence/static/description/index.html index 3272593e217e..9f29fc8498c3 100644 --- a/product_lot_sequence/static/description/index.html +++ b/product_lot_sequence/static/description/index.html @@ -367,27 +367,33 @@

Product Lot Sequence

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:043a59e32b82ffdcafdd494fdb97e28127e8489913d173aefed770e79efc18ce +!! source digest: sha256:b40154ba5f1de85d89cb1c8da85a999bd0cd850538e477e4eb0d9a7272af0bbd !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

Adds ability to define a lot sequence from the product which will be proposed upon creating new lots.

Table of contents

Configuration

+
+

Lot Sequence policy

There are two ways you can configure this module through the use of System Parameter product_lot_sequence.policy:

    @@ -401,8 +407,14 @@

    Configuration

    behaviour from odoo 15.0 which will look for the last lot number for each product and will increment it.

+
+

Default Number of Digits for Product Sequence Generation

+

The default is 7 digits. To change that to something else, go to the inventory +configuration, find “Sequence Number of Digits” and change the number.

+
+
-

Usage

+

Usage

To use this module:

  • Go to Inventory > Products
  • @@ -414,7 +426,7 @@

    Usage

-

Known issues / Roadmap

+

Known issues / Roadmap

  • There is an issue with the use of ir.sequence with the newer version of Odoo.
@@ -428,7 +440,7 @@

Known issues / Roadmap

cf https://github.com/OCA/product-attribute/issues/1326

-

Bug Tracker

+

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 to smash it by providing a detailed and welcomed @@ -436,23 +448,27 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ForgeFlow S.L.
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/product_lot_sequence/views/product_views.xml b/product_lot_sequence/views/product_views.xml index 15d82a9720a8..31d283b9317d 100644 --- a/product_lot_sequence/views/product_views.xml +++ b/product_lot_sequence/views/product_views.xml @@ -10,11 +10,11 @@ + + + res.config.settings.view.form.inherit.stock + res.config.settings + + + +

+
+
+
+ + + +