Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions product_battery/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===============
Product battery
===============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:191f68a557baa0d00b7d9d3b2ee1e4e239e408ea2e6974f8392bc6d18c0f4d34
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/16.0/product_battery
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_battery
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module gives the possibility to add battery information to the product.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

#. Install the module
#. Go to a product
#. In the tab battery you can add battery information for the product

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_battery%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Therp BV

Contributors
~~~~~~~~~~~~

* lfreeke <[email protected]>


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/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_battery>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions product_battery/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
21 changes: 21 additions & 0 deletions product_battery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product battery",
"summary": "Register batteries on products",
"version": "16.0.1.0.0",
"category": "product",
"website": "https://github.com/OCA/product-attribute",
"author": "Therp BV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"product",
"stock",
],
"data": [
"security/ir.model.access.csv",
"views/product_template.xml",
],
}
4 changes: 4 additions & 0 deletions product_battery/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import product_battery
from . import product_template
62 changes: 62 additions & 0 deletions product_battery/models/product_battery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2025 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ProductBattery(models.Model):
_name = "product.battery"

product_tmpl_id = fields.Many2one("product.template")
battery_type = fields.Selection(
[
("primary", "Primary (non-rechargeable)"),
("secondary", "Secondary (rechargeable)"),
],
)
battery_qty = fields.Integer(string="Quantity")
battery_chemistry = fields.Selection(
[
("alkaline", "Alkaline (Zn/MnO2)"),
("nickel_cadmium", "Nickel-Cadmium (Ni/Cd)"),
("nickel_metal_hydride", "Nickel-Metal Hydride (Ni/MH)"),
("lithium_cobalt_oxide", "Lithium Cobalt Oxide (LiCoO2)"),
("lithium_polymer", "Lithium Polymer"),
("lead_acid", "Lead-Acid (Pb/PbO2)"),
("lithium_iron_phosphate", "Lithium Iron Phosphate (LiFePO4)"),
("zinc_carbon", "Zinc-Carbon (Zn/C)"),
("silver_oxide", "Silver Oxide (Ag2O)"),
("mercury_oxide", "Mercury Oxide (HgO)"),
("sodium_sulfur", "Sodium-Sulfur (Na/S)"),
],
)
battery_form = fields.Selection(
[
("cylindrical", "Cylindrical"),
("prismatic", "Prismatic"),
("pouch", "Pouch"),
("button_cell", "Button Cell Small"),
("square", "Square"),
("lead-acid", "Lead-Acid"),
(
"pack",
"Pack",
),
],
)
battery_weight = fields.Float(string="Battery Weight in Grams")
battery_charge_capacity = fields.Float(string="Battery Charge Capacity (mAh)")
battery_capacity = fields.Char(string="Battery Capacity mWh")
battery_voltage = fields.Float(string="Battery Voltage (V)")
battery_removable = fields.Selection(
[
("yes", "Yes"),
(
"no",
"No",
),
],
string="Removable",
)
battery_manufacture = fields.Char(string="Manufacture")
reference_to_battery_product = fields.Char("Internal Reference")
13 changes: 13 additions & 0 deletions product_battery/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

battery_ids = fields.One2many(
"product.battery",
"product_tmpl_id",
string="Battery",
)
2 changes: 2 additions & 0 deletions product_battery/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* lfreeke <[email protected]>

1 change: 1 addition & 0 deletions product_battery/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module gives the possibility to add battery information to the product.
5 changes: 5 additions & 0 deletions product_battery/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

#. Install the module
#. Go to a product
#. In the tab battery you can add battery information for the product
2 changes: 2 additions & 0 deletions product_battery/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_battery,product.battery manager,model_product_battery,stock.group_stock_user,1,1,1,1
Loading