From 792a7f64e68e58f302df14430697bc435d56da7a Mon Sep 17 00:00:00 2001 From: Bhavesh Heliconia Date: Fri, 26 Jun 2026 13:59:35 +0530 Subject: [PATCH] [FIX] vcp_management: Fix color_picker Owl crash on request label creation --- vcp_management/README.rst | 6 +-- vcp_management/__manifest__.py | 2 +- .../migrations/18.0.1.0.2/pre-migration.py | 29 ++++++++++++ vcp_management/models/vcp_request_label.py | 2 +- vcp_management/static/description/index.html | 46 ++++++++----------- 5 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 vcp_management/migrations/18.0.1.0.2/pre-migration.py diff --git a/vcp_management/README.rst b/vcp_management/README.rst index 47e3b4f..6e30f6c 100644 --- a/vcp_management/README.rst +++ b/vcp_management/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ============== VCP Management ============== @@ -17,7 +13,7 @@ VCP Management .. |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 +.. |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%2Fversion--control--platform-lightgray.png?logo=github diff --git a/vcp_management/__manifest__.py b/vcp_management/__manifest__.py index c6b4a20..c003f3b 100644 --- a/vcp_management/__manifest__.py +++ b/vcp_management/__manifest__.py @@ -4,7 +4,7 @@ { "name": "VCP Management", "summary": """Management for your Version Control Platforms""", - "version": "18.0.1.0.1", + "version": "18.0.1.0.2", "license": "AGPL-3", "author": "Dixmit,Odoo Community Association (OCA)", "website": "https://github.com/OCA/version-control-platform", diff --git a/vcp_management/migrations/18.0.1.0.2/pre-migration.py b/vcp_management/migrations/18.0.1.0.2/pre-migration.py new file mode 100644 index 0000000..38f8f8f --- /dev/null +++ b/vcp_management/migrations/18.0.1.0.2/pre-migration.py @@ -0,0 +1,29 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + if not version: + return + + _logger.info( + "Safely casting 'color' from VARCHAR to INTEGER in vcp_request_label..." + ) + + # 1. First, handle any edge cases where color might be empty or not a number + cr.execute(""" + UPDATE vcp_request_label + SET color = '0' + WHERE color IS NULL OR color = '' OR color !~ '^[0-9]+$'; + """) + + # 2. Use the 'USING' clause to safely cast the strings to integers + cr.execute(""" + ALTER TABLE vcp_request_label + ALTER COLUMN color TYPE int4 USING color::integer; + """) + + _logger.info("Successfully converted 'color' column.") diff --git a/vcp_management/models/vcp_request_label.py b/vcp_management/models/vcp_request_label.py index 5058c16..eb97735 100644 --- a/vcp_management/models/vcp_request_label.py +++ b/vcp_management/models/vcp_request_label.py @@ -13,7 +13,7 @@ class VcpRequestLabel(models.Model): name = fields.Char(required=True, readonly=True) - color = fields.Char(default=lambda x: x._default_color()) + color = fields.Integer(default=lambda x: x._default_color()) request_ids = fields.Many2many( comodel_name="vcp.request", diff --git a/vcp_management/static/description/index.html b/vcp_management/static/description/index.html index 19170a0..065b147 100644 --- a/vcp_management/static/description/index.html +++ b/vcp_management/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +VCP Management -
+
+

VCP Management

- - -Odoo Community Association - -
-

VCP Management

-

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

Creates a set of modules used for handling a version control patform.

Table of contents

@@ -406,41 +401,41 @@

VCP Management

-

Use Cases / Context

+

Use Cases / Context

The aim of this module is to allow any community to import data from a version control system.

The system should be done in a way that is agnostic to the system and the connections are handled directly by specific modules.

-

Definitions

+

Definitions

-

Hosts

+

Hosts

Hosts are the origin of data. Each host has a type that helps us know how to integrate with the system. For example, on Github there is only one host (github.com). However, in Gitlab there could be one for each instance that we are integrating too.

-

Platform

+

Platform

We understand that a platform is an entity that can provide code and information to our Version Control Platform (VCP). A platform could be an organization on Github (like OCA) or Gitlab for example.

-

Repository

+

Repository

A repository is an origin of code. For example, this repository could be a VCP repository.

-

Requests

+

Requests

A request is what contributors do to propose new codes. In Github it is a Pull request, however in Gitlab it is called Merge Request.

When a user makes a review on a request, it markes their resolution and some comments. That would correspond to Reviews and Comments.

-

Rules

+

Rules

Inside a Platform or repository, we can apply some rules to get some basic statistics. This rules are usually done by downloading the code locally and then it can give some basic information like number of lines @@ -449,20 +444,20 @@

Rules

-

Usage

+

Usage

-

Creation

+

Creation

First step is to create a Platform. In the platform we need to set the host (you might need to create it on gitlab) and add some Platform Keys.

This keys will allow us to integrate with the origin system.

-

Refresh

+

Refresh

By default, the system provides some refresh rules for platforms and repositories, however we can deactivate or activate it manualy.

-

Management of rules

+

Management of rules

One of the capabilities of this module is the generation of rules.

This rules allow us to know some information of the repository.

By default, the system adds some rules aligned with odoo to make it @@ -479,7 +474,7 @@

Management of rules

-

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 @@ -487,15 +482,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Dixmit
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -521,6 +516,5 @@

Maintainers

-