Bläddra i källkod

add Planeacion de proyecto

erickabrego 9 månader sedan
förälder
incheckning
d3b10f1a33

+ 3 - 0
custom_project/__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import models

+ 18 - 0
custom_project/__manifest__.py

@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "Personalización de proyectos y planeación",
+    'summary': "Personalización de proyectos añadiendo información extra y cambiando flujos de tiempos",
+    'description': """
+        Añadiendo flujos al momento de captura de fechas de planeación.
+    """,
+    'author': "M22 - Erick",
+    'website': "https://www.yourcompany.com",
+    'category': 'Services/Project',
+    'version': '18.1',
+    'depends': ['base','project','project_enterprise'],
+    'data': [
+        'views/project_task.xml'
+    ],
+    'license': 'AGPL-3'
+}
+

+ 3 - 0
custom_project/models/__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import project_task

+ 27 - 0
custom_project/models/project_task.py

@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from odoo import models, fields, api
+from datetime import datetime, timedelta
+
+class ProjectTask(models.Model):
+    _inherit = "project.task"
+
+    x_start_date = fields.Date(string="Fecha inicio")
+    x_end_date = fields.Date(string="Fecha final")
+
+    @api.depends('date_deadline', 'planned_date_begin', 'user_ids')
+    def _compute_allocated_hours(self):
+        for rec in self:
+            rec.allocated_hours = 0
+
+    @api.onchange("x_start_date")
+    def onchange_start_date(self):
+        for rec in self:
+            if rec.x_start_date:
+                rec.planned_date_begin = datetime.combine(rec.x_start_date, datetime.min.time()) + timedelta(hours=9)
+
+    @api.onchange("x_end_date")
+    def onchange_end_date(self):
+        for rec in self:
+            if rec.x_end_date:
+                rec.date_deadline = datetime.combine(rec.x_end_date, datetime.min.time()) + timedelta(hours=9)

+ 28 - 0
custom_project/views/project_task.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <data>
+
+        <record id="custom_project_project_task_form" model="ir.ui.view">
+            <field name="name">custom_project_project_task_form</field>
+            <field name="model">project.task</field>
+            <field name="inherit_id" ref="project_enterprise.project_task_view_form"/>
+            <field name="arch" type="xml">
+<!--                <xpath expr="//field[@name='date_deadline']" position="replace"/>-->
+
+<!--                <xpath expr="//field[@name='recurring_task']" position="replace"/>-->
+
+                <xpath expr="//div[@id='date_deadline_and_recurring_task']" position="after">
+                    <label for="x_start_date" string="Fechas planeadas"/>
+                    <div id="planned_date_task" class="d-inline-flex w-100">
+                        <field name="x_end_date" invisible="1" required="1"/>
+                        <field name="x_start_date" required="1" widget="daterange" options="{'end_date_field': 'x_end_date'}"/>
+                        <field name="recurring_task" nolabel="1" class="ms-0" style="width: fit-content;" widget="boolean_icon" options="{'icon': 'fa-repeat'}" invisible="not active or parent_id" groups="project.group_project_recurring_tasks"/>
+                    </div>
+
+                </xpath>
+
+            </field>
+        </record>
+
+    </data>
+</odoo>