-
Notifications
You must be signed in to change notification settings - Fork 70
[ADD] sale_order_type_project: new module #1516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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", | ||
| "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, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import sale_order_type | ||
| from . import sale_order |
| 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 |
| 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", | ||||||||
|
||||||||
| help="Select to define the analytics account", | |
| help="Select to define the analytics account", | |
| ondelete="restrict", |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
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:
- Un modelo
sale.orderque herede y propague elproject_iddesdetype_id.project_ida las líneas de orden (donde se utiliza realmente en el módulosale_project). - Alternativamente, actualizar el texto de ayuda para reflejar que este campo es solo informativo y no se propaga automáticamente.
| 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> |
There was a problem hiding this comment.
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.