Skip to content
Extraits de code Groupes Projets
Valider 37c8ac65 rédigé par Juliana's avatar Juliana
Parcourir les fichiers

Creation

parent
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# -*- coding: utf-8 -*-
import models
\ No newline at end of file
{
'name': 'Le Filament - Link Sales Order to Project',
'version': '10.0.1.0',
'description': """
MODULE LINK SALE ORDER / PROJECT LE FILAMENT
Etend l'application Projet :
- Créer un projet à partir d'un bon de commande
- Créer une tâche par ordre
""",
'author': 'LE FILAMENT',
'category': 'LE FILAMENT',
'depends': ['sale_timesheet'],
'contributors': [
'Juliana Poudou <juliana@le-filament.com>',
],
'website': 'http://www.le-filament.com',
'data': [
'views/product_views.xml',
'views/sale_config_settings_views.xml',
],
'qweb': [
],
}
# -*- coding: utf-8 -*-
import lf_link_sale_project
import product
import procurement
import sale_order
import sale_config_settings
\ No newline at end of file
# -*- coding: utf-8 -*-
from datetime import datetime, date
import time
from odoo import tools
from odoo import models, fields, api, osv
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class LeFilamentProcurementOrder(models.Model):
_inherit = 'procurement.order'
def _get_stage_id(self):
Stage = self.env['project.task.type']
stage = self.product_id.with_context(force_company=self.company_id.id).project_task_type_id
if not stage:
stage_id = self.env['ir.values'].get_default('sale.config.settings', 'project_task_type_id')
stage = self.env['project.task.type'].browse(stage_id)
return stage
def _update_project_data(self, project):
project.lf_total_budget = project.lf_total_budget + self.sale_line_id.price_subtotal
project.name = self.sale_line_id.order_id.partner_id.name
def _create_service_task(self):
stage = self._get_stage_id()
project = self._get_project()
self._update_project_data(project)
planned_hours = self._convert_qty_company_hours()
task = self.env['project.task'].create({
'name': '%s:%s' % (self.origin or '', self.product_id.name),
'date_deadline': self.date_planned,
'planned_hours': planned_hours,
'remaining_hours': planned_hours,
'partner_id': self.sale_line_id.order_id.partner_id.id or self.partner_dest_id.id,
'user_id': self.env.uid,
'procurement_id': self.id,
'description': self.name + '<br/>',
'project_id': project.id,
'company_id': self.company_id.id,
'stage_id': stage.id,
})
self.write({'task_id': task.id})
msg_body = _("Task Created (%s): <a href=# data-oe-model=project.task data-oe-id=%d>%s</a>") % (self.product_id.name, task.id, task.name)
self.message_post(body=msg_body)
if self.sale_line_id.order_id:
self.sale_line_id.order_id.message_post(body=msg_body)
task_msg = _("This task has been created from: <a href=# data-oe-model=sale.order data-oe-id=%d>%s</a> (%s)") % (self.sale_line_id.order_id.id, self.sale_line_id.order_id.name, self.product_id.name)
task.message_post(body=task_msg)
return task
\ No newline at end of file
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class LeFilamentProductTemplate(models.Model):
_inherit = 'product.template'
project_task_type_id = fields.Many2one(
'project.task.type', 'Project Task Type')
\ No newline at end of file
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
class LeFilamentSaleConfiguration(models.TransientModel):
_inherit = 'sale.config.settings'
project_task_type_id = fields.Many2one(
'project.task.type', 'Project Task Type')
@api.multi
def set_project_task_type(self):
return self.env['ir.values'].sudo().set_default(
'sale.config.settings', 'project_task_type_id', self.project_task_type_id.id)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class LeFilamentSaleOrder(models.Model):
_inherit = 'sale.order'
\ No newline at end of file
static/description/icon.png

8,95 ko

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="lefilament_view_product_timesheet_form" model="ir.ui.view">
<field name="name">lefilament.product.template.timesheet.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sale_timesheet.view_product_timesheet_form"/>
<field name="arch" type="xml">
<field name="project_id" position="after">
<field name="project_task_type_id" attrs="{'invisible':['|', ('type','!=','service'), ('track_service', '&lt;&gt;', 'task')]}"/>
</field>
</field>
</record>
</odoo>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="lefilament_view_sales_config" model="ir.ui.view">
<field name="name">lefilament.sale.settings</field>
<field name="model">sale.config.settings</field>
<field name="inherit_id" ref="sale.view_sales_config"/>
<field name="arch" type="xml">
<div id="main" position="inside">
<group string="Tâches">
<field name="project_task_type_id" class="oe_inline"/>
</group>
</div>
</field>
</record>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
</data>
</odoo>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter