Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import account_asset_profile
from . import account_asset

View File

@@ -0,0 +1,47 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountAsset(models.Model):
_inherit = "account.asset"
_rec_name = "number"
number = fields.Char(
string="Asset Number",
default="",
index=True,
copy=False,
)
use_sequence = fields.Boolean(related="profile_id.use_sequence")
def validate(self):
res = super().validate()
for asset in self:
asset_profile = asset.profile_id
if (
asset.number in [False, ""]
and asset_profile.use_sequence
and asset_profile.sequence_id
):
asset.number = asset_profile.sequence_id.next_by_id()
return res
@api.model
def _xls_acquisition_fields(self):
acquisition_fields = super()._xls_acquisition_fields()
acquisition_fields.insert(acquisition_fields.index("name"), "number")
return acquisition_fields
@api.model
def _xls_active_fields(self):
active_fields = super()._xls_active_fields()
active_fields.insert(active_fields.index("name"), "number")
return active_fields
@api.model
def _xls_removal_fields(self):
removal_fields = super()._xls_removal_fields()
removal_fields.insert(removal_fields.index("name"), "number")
return removal_fields

View File

@@ -0,0 +1,43 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountAssetProfile(models.Model):
_inherit = "account.asset.profile"
use_sequence = fields.Boolean(
string="Auto Asset Number by Sequence",
help="If check, asset number auto run by sequence.",
)
sequence_id = fields.Many2one(
comodel_name="ir.sequence",
string="Asset Number Sequence",
domain=lambda self: self._get_domain_sequence_id(),
)
barcode_type = fields.Selection(
selection=[("barcode", "Barcode"), ("qr", "QR")],
default="barcode",
)
barcode_width = fields.Integer(
default=350,
help="Width (in px) of the barcode or the QR code",
)
barcode_height = fields.Integer(
default=75,
help="Height (in px) of the barcode or the QR code",
)
@api.model
def _get_domain_sequence_id(self):
return [("company_id", "in", [False, self.env.company.id])]
@api.onchange("barcode_type")
def _onchange_barcode_type(self):
# Set default values when type is changed
if self.barcode_type == "barcode":
self.barcode_width = 300
self.barcode_height = 75
elif self.barcode_type == "qr":
self.barcode_width = 150