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
5 changes: 5 additions & 0 deletions sale_order_type_project/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import models
39 changes: 39 additions & 0 deletions sale_order_type_project/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Sale Order Type Project",
"version": "18.0.1.0.0",
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La versión del módulo está configurada como "18.0.1.0.0", pero según el contexto del repositorio (rama 19.0 mencionada en las guías), debería ser "19.0.1.0.0". Es importante que la versión del manifest coincida con la versión de Odoo objetivo.

Copilot generated this review using guidance from repository custom instructions.
"category": "Sales & Purchases",
"sequence": 14,
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"sale_project",
"sale_order_type",
],
"data": [
"views/sale_order_type_view.xml",
],
"installable": True,
"auto_install": False,
"application": False,
}
2 changes: 2 additions & 0 deletions sale_order_type_project/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order_type
from . import sale_order
17 changes: 17 additions & 0 deletions sale_order_type_project/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import api, models


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.depends("type_id")
def _compute_project_id(self):
res = super()._compute_project_id()
for order in self.filtered("type_id"):
order_type = order.type_id
if order_type.project_id:
order.project_id = order_type.project_id
return res
14 changes: 14 additions & 0 deletions sale_order_type_project/models/sale_order_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class SaleOrderType(models.Model):
_inherit = "sale.order.type"

project_id = fields.Many2one(
comodel_name="project.project",
domain=[("allow_billable", "=", True)],
string="Project",
help="Select to define the analytics account",
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falta especificar el parámetro ondelete en el campo Many2one. Este parámetro define qué ocurre con los registros de sale.order.type cuando se elimina el proyecto relacionado. Se recomienda usar ondelete="restrict" para evitar eliminar proyectos que están siendo usados en tipos de orden, o ondelete="set null" si se prefiere simplemente limpiar la referencia.

Suggested change
help="Select to define the analytics account",
help="Select to define the analytics account",
ondelete="restrict",

Copilot uses AI. Check for mistakes.
)
Comment on lines +13 to +14
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El texto de ayuda menciona "Select to define the analytics account", pero el módulo actualmente solo agrega el campo project_id al tipo de orden sin implementar ninguna lógica para propagar este valor a las órdenes de venta o sus líneas. Para que el módulo sea funcional, debería incluir:

  1. Un modelo sale.order que herede y propague el project_id desde type_id.project_id a las líneas de orden (donde se utiliza realmente en el módulo sale_project).
  2. Alternativamente, actualizar el texto de ayuda para reflejar que este campo es solo informativo y no se propaga automáticamente.

Copilot generated this review using guidance from repository custom instructions.
13 changes: 13 additions & 0 deletions sale_order_type_project/views/sale_order_type_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sot_sale_order_type_form_view" model="ir.ui.view">
<field name="name">sale.order.type.form.view</field>
<field name="model">sale.order.type</field>
<field name="inherit_id" ref="sale_order_type.sot_sale_order_type_form_view"/>
<field name="arch" type="xml">
<field name="sequence_id" position="after">
<field name="project_id" groups="project.group_project_user,analytic.group_analytic_accounting" context="{'default_allow_billable': True}" />
</field>
</field>
</record>
</odoo>