-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from kmee/14.0-add-l10n_br_sale_order_product_…
…availability_inline [ADD] Addon: l10n_br_sale_order_product_availability_inline
- Loading branch information
Showing
9 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**This file is going to be generated by oca-gen-addon-readme.** | ||
|
||
_Manual changes will be overwritten._ | ||
|
||
Please provide content in the `readme` directory: | ||
|
||
- **DESCRIPTION.rst** (required) | ||
- INSTALL.rst (optional) | ||
- CONFIGURE.rst (optional) | ||
- **USAGE.rst** (optional, highly recommended) | ||
- DEVELOP.rst (optional) | ||
- ROADMAP.rst (optional) | ||
- HISTORY.rst (optional, recommended) | ||
- **CONTRIBUTORS.rst** (optional, highly recommended) | ||
- CREDITS.rst (optional) | ||
|
||
Content of this README will also be drawn from the addon manifest, from keys such as | ||
name, authors, maintainers, development_status, and license. | ||
|
||
A good, one sentence summary in the manifest is also highly recommended. | ||
|
||
Automatic changelog generation | ||
|
||
``` | ||
`HISTORY.rst` can be auto generated using `towncrier <https://pypi.org/project/towncrier>`_. | ||
Just put towncrier compatible changelog fragments into `readme/newsfragments` | ||
and the changelog file will be automatically generated and updated when a new fragment is added. | ||
Please refer to `towncrier` documentation to know more. | ||
NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. | ||
If you need to run it manually, refer to `OCA/maintainer-tools README <https://github.com/OCA/maintainer-tools>`_. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
14 changes: 14 additions & 0 deletions
14
l10n_br_sale_order_product_availability_inline/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "L10n Br Sale Order Product Availability Inline", | ||
"summary": "Show product availability in sales order line product " "drop-down.", | ||
"version": "14.0.1.0.0", | ||
"development_status": "Beta", | ||
"category": "Sales Management", | ||
"website": "https://github.com/KMEE/kmee-odoo-addons", | ||
"author": "KMEE, Odoo Community Association (OCA)", | ||
"maintainers": ["KMEE"], | ||
"license": "AGPL-3", | ||
"depends": ["sale_order_product_availability_inline", "l10n_br_sale"], | ||
} |
2 changes: 2 additions & 0 deletions
2
l10n_br_sale_order_product_availability_inline/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import account_move_line | ||
from . import product_product |
19 changes: 19 additions & 0 deletions
19
l10n_br_sale_order_product_availability_inline/models/account_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class SaleOrderLine(models.Model): | ||
|
||
_inherit = "sale.order.line" | ||
|
||
@api.onchange("product_id") | ||
def product_id_change(self): | ||
res = super(SaleOrderLine, self).product_id_change() | ||
|
||
if self.product_id: | ||
self.name = self.product_id.display_name.replace( | ||
self.product_id.availability_text_get(), "" | ||
) | ||
return res |
19 changes: 19 additions & 0 deletions
19
l10n_br_sale_order_product_availability_inline/models/product_product.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
|
||
_inherit = "product.product" | ||
|
||
def availability_text_get(self): | ||
self.ensure_one() | ||
precision = self.env["decimal.precision"].precision_get( | ||
"Product Unit of Measure" | ||
) | ||
availability_text = "({:.{}f} {})".format( | ||
self.free_qty, precision, self.uom_id.name | ||
) | ||
return availability_text |
1 change: 1 addition & 0 deletions
1
...er_product_availability_inline/odoo/addons/l10n_br_sale_order_product_availability_inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../l10n_br_sale_order_product_availability_inline |
6 changes: 6 additions & 0 deletions
6
setup/l10n_br_sale_order_product_availability_inline/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |