Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Action to create Project from sales order

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
actionprojectsales.order
4 Răspunsuri
1731 Vizualizări
Imagine profil
Phred

I want to be able to create a project from the sales order. Odoo seems to only allow this for a sales order with 'service' products, but I want to create a project for any sales order, regardless of the product.


The only way I can work out to achieve this is with an 'execute code' server action, as below.


This seems to achieve what I want, however as I am on an enterprise license I have to pay extra to use the code, so I am hoping there is a simpler solution to this. Also my python experience is quite limited and I am unsure if I have coded this in a reliable way...


Does anyone know of a better solution to this problem? any help is much appreciated.

if record.project_id:
    raise UserError("This Sales Order already has a linked project.")
   
# Get sequence number
seq = env['ir.sequence'].next_by_code('project.seq')

# Combine with opportunity name if available
if record.opportunity_id:
    opp_name = record.opportunity_id.name
else:
    opp_name = ""

if opp_name:
    project_name = f"{seq} | {opp_name}"
else:
    project_name = seq

# Create project
project = env['project.project'].create({
    'name': project_name,
    'partner_id': record.partner_id.id,
    'use_documents': False,
})

record.write({'project_id': project.id})


0
Imagine profil
Abandonează
Imagine profil
JB
Cel mai bun răspuns

Hello,

Please Refer the code:

1.Python code:

from odoo import models, fields, api


class SaleOrder(models.Model):

    _inherit = "sale.order"


    project_id = fields.Many2one("project.project", string="Project")


    def action_create_project(self):

        Project = self.env["project.project"]

        for order in self:

            if not order.project_id:

                project = Project.create({

                    "name": order.name,

                    "partner_id": project.id

        return True


2. Xml Code

<record id="view_order_form_inherit_project" model="ir.ui.view">

    <field name="name">sale.order.form.inherit.project</field>

    <field name="model">sale.order</field>

    <field name="inherit_id" ref="sale.view_order_form"/>

    <field name="arch" type="xml">

        <header position="inside">

            <button name="action_create_project"

                    type="object"

                    string="Create Project"

                    class="btn-primary"

                    attrs="{'invisible': [('project_id','!=',False)]}"/>

        </header>

        <sheet position="after">

            <field name="project_id"/>

        </sheet>

    </field>

</record>


0
Imagine profil
Abandonează
Chris TRINGHAM

This isn't an answer to the question that has been asked!

Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

Please refer to the code:


from odoo import api, fields, models

from odoo.exceptions import UserError


class SaleOrder(models.Model):

    _inherit = "sale.order"


    project_id = fields.Many2one('project.project', string="Project")


    def action_create_project(self):

        for order in self:

            if order.project_id:

                raise UserError("This Sales Order already has a linked project.")


            seq = self.env['ir.sequence'].next_by_code('project.seq') or order.name

            opp_name = order.opportunity_id.name if order.opportunity_id else ""

            project_name = f"{seq} | {opp_name}" if opp_name else seq


            project = self.env['project.project'].create({

                'name': project_name,

                'partner_id': order.partner_id.id,

            })

            order.project_id = project.id


Hope it helps.

0
Imagine profil
Abandonează
Imagine profil
D Enterprise
Cel mai bun răspuns

Hi,

if record. project_id:

    raise UserError("This Sales Order already has a linked project.")


# Get sequence value or fallback

seq = env['ir.sequence'].next_by_code('project.seq') or 'NEW/PROJECT'


# Get opportunity name if exists

opp_name = record.opportunity_id.name if record.opportunity_id else ''


# Build project name

project_name = f"{seq} | {opp_name}" if opp_name else seq


# Create new project

project = env['project.project'].create({

    'name': project_name,

    'partner_id': project.id })

try this 
i hope it is use full

0
Imagine profil
Abandonează
Imagine profil
Ruchita
Cel mai bun răspuns

In Odoo, a project is typically created from a Sales Order when you sell a service product that is configured to trigger project creation.

✅ Steps:

  1. Go to Sales > Products and open the service product.
  2. Set:
    • Product Type: Service
    • Service Invoicing Policy: Based on Milestones or Timesheets on Tasks
    • Service Tracking: Choose one of the following:
      • Create a task in an existing project
      • Create a new project but no task
      • Create a new project and task
  3. When you confirm a Sales Order containing that product, Odoo will automatically create the project or task depending on your selection.

You can then manage the project from the Projects module.

-1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Lifemiles teléfono ¿Cómo puedo llamar al soporte de Lifemiles?
action project
Imagine profil
0
oct. 25
3
How to show sales order data in the projects module Rezolvat
project sales.order related_fields
Imagine profil
1
iun. 22
6901
Set project_id on new tasks automatically
action project automated
Imagine profil
3
feb. 20
4341
How to make a new save button? Rezolvat
action project custom
Imagine profil
Imagine profil
1
iul. 19
15816
How to access my DNS?
action project chrome service
Imagine profil
0
nov. 25
40
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now