Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to add a "product" field to a project issue?

Naroči se

Get notified when there's activity on this post

This question has been flagged
fieldcustommodelissue
2 Odgovori
7083 Prikazi
Avatar
Martin

I have defined a new model "bicycle" for a virtual bicycle factory. Every bicycle has a frame number, type etc. When a customer calls, who has an issue with one or more bicycles, I like to add references in the issue to the bicycles by referencing the affected bicycles in the project issue form. An issue can be about zero or more bicycles, and a bicycle can have zero or more issues.

How would I implement this?

What is the correct type of the new field in the project issue model? one2many or many2many or something else? Do I need to do sth. in the XML view to prevent creation of a new bicycle object from the project issue? I want only reference bicycles already existing in the database. When I add a one2many field x_bicycle in the project issue table and use a <field name="x_bicycle"/> in the project issue form view, I get the following error:

ProgrammingError: operator does not exist: character varying = integer
LINE 1: ....id FROM "bicycle" WHERE ("bicycle"."framenumber" in (2)) OR...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

What am I doing wrong? Thanks in advance!

This is bicycle.py:

from osv import fields, osv
import time

class bicycle(osv.osv):
    _name = "bicycle"
    _description = "Bicycle"
    _rec_name = "framenumber"
    _columns = {
        'framenumber': fields.char('Frame Number', size=7, required=True),
        'mechanic': fields.char('Mechanic Acronym', size=20),
        'productiondt': fields.datetime('Date/Time of Production'),
        'type': fields.selection(
            [('C', 'City Bicycle'),
             ('R', 'Road Bicycle'),
             ('T', 'Touring Bicycle'),
             ('F', 'Folding Bicycle')],
            'Type'),
        'framerevision': fields.selection(
            [('A', 'Revision A'),
             ('B', 'Revision B')],
            'Frame Revision'),
        }

    _sql_constraints = [
        ('framenumber_uniq', 'unique (framenumber)', 'The frame number must be unique!')
        ]

bicycle()

This is bicycle_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="bicycle_tree_view">
            <field name="name">bicycle.tree</field>
            <field name="model">bicycle</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Bicycle">
                    <field name="framenumber"/>
                    <field name="type"/>
                    <field name="framerevision"/>
                    <field name="mechanic"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="bicycle_form_view">
            <field name="name">bicycle.form</field>
            <field name="model">bicycle</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Bicycle">
                    <field name="framenumber"/>
                    <field name="type"/>
                    <field name="framerevision"/>
                    <field name="mechanic"/>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_bicycle_form">
            <field name="name">bicycle</field>
            <field name="res_model">bicycle</field>
        </record>

        <menuitem name="Bicycle"
          parent="project.menu_project_management"
          id="bicycle_menu_mainform" action="action_bicycle_form"/>
    </data>
</openerp>
2
Avatar
Opusti
Avatar
Martin
Avtor Best Answer

It seems, that the right field type for pointing from project issues to bicycles is many2many. It works mainly as I want it, with some minor UI issues to work on.

0
Avatar
Opusti
Avatar
Ali Ravani
Best Answer

you should use one2many fields.. which will show all the fields in form and tree view both...

0
Avatar
Opusti
Martin
Avtor

Thanks, but this did not work for me. I rephrased my question and added some code to make clear, what I like to do.

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
How can I mark a field "unique" in a custom model? Solved
field custom unique model
Avatar
Avatar
Avatar
Avatar
3
sep. 24
48109
add an existing field to a model
field custom state model
Avatar
Avatar
1
mar. 15
7885
Custom model - avoid deleting values when in use Solved
custom model
Avatar
Avatar
2
mar. 22
3558
what's the field '_date_name' means in a model
field model
Avatar
0
mar. 24
4229
Field referring to the same model?
field custom related model same
Avatar
Avatar
3
jun. 17
7771
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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