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
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    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

Values has false in one2many field when changing the customer in Sale Order ODOO 10

Abonare

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

Această întrebare a fost marcată
one2manysale.order.lineodoo10
6090 Vizualizări
Imagine profil
Muniswaran

I Have an one one2many field in Sale Order Line model in that one2many field I have a three fields in them. When I am creating a new sale order record and I am choosing a customer then I am clicking as add an item in Order Lines Page and I am choosing one product  and below the product field I added one2many field and I am given the values for them then in tree view itself ... then I am save and close the one2many order lines page record. 

Before I am savings the sale order record I am just changing the customer value then I am seeing the product value in that I given one2many record values are false but the record created is showing only that the record inside values get false.

I am having major issue in this... 

Is there any bug in the sale order model for the version odoo10..

How can I solve this..?


https://youtu.be/By_B6uOviSU


Here above I given a youtube link that I taken demo for the one2many error.

Here Below I given a source code that I developed in sale order model

sale.py


# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.


from odoo import api, fields, models, _



class SaleMandatoryAddons(models.Model):
    _name = "sale.mandatory.addons"
    _description = "Mandatory Addons"
   
    sale_order_line_id = fields.Many2one('sale.order.line', 'Sale Order Line')
    number = fields.Integer('Sequence', required=True)
    product_id = fields.Many2one('product.product', 'Item Name', required=True)    
    
    quantity = fields.Float('Recommended Quantity', required=True, digits=dp.get_precision('Product Unit of Measure'))
                    
class SaleOptionalAddons(models.Model):
    _name = "sale.optional.addons"
    _description = "Optional Addons"
    
    sale_order_line_id = fields.Many2one('sale.order.line', 'Sale Order Line')
    number = fields.Integer('Sequence', required=True)
    product_id = fields.Many2one('product.product', 'Item Name', required=True)
    quantity = fields.Float('Actual Recommended Quantity', required=True, digits=dp.get_precision('Product Unit of Measure')) 
    

class SaleOrderLine(models.Model):
    _name = 'sale.order.line'
    _inherit = 'sale.order.line'
    _description = 'Sales Order Line'    


    mandatory_addons = fields.One2many('sale.mandatory.addons', 'sale_order_line_id', 'Mandatory Addons', copy=True)
    optional_addons = fields.One2many('sale.optional.addons', 'sale_order_line_id', 'Optional Addons', copy=True)    
        

sale_order_view.xml


<?xml version="1.0" encoding="utf-8"?>
<odoo>

	<record id="view_quotation_form" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <form string="Sales Order" class="o_sale_order">
                <header>
                    <button name="%(sale.action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" class="btn-primary"
                        attrs="{'invisible': [('invoice_status', '!=', 'to invoice')]}"/>
                    <button name="%(sale.action_view_sale_advance_payment_inv)d" string="Create Invoice"
                        type="action" context="{'default_advance_payment_method': 'percentage'}"
                        attrs="{'invisible': ['|',('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="btn-primary"/>
                    <button name="print_quotation" string="Print" type="object" states="draft" class="btn-primary"/>
                    <button name="action_confirm" states="sent" string="Confirm Sale" class="btn-primary o_sale_confirm" type="object" />
                    <button name="action_confirm" states="draft" string="Confirm Sale" class="o_sale_confirm" type="object" />
                    <button name="print_quotation" string="Print" type="object" states="sent,sale"/>
                    <button name="action_quotation_send" string="Send by Email" type="object" states="sent,sale"/>
                    <button name="action_cancel" states="draft,sent,sale" type="object" string="Cancel"/>
                    <button name="action_draft" states="cancel" type="object" string="Set to Quotation"/>
                    <button name="action_done" type="object" string="Lock" states="sale"
                        help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver."/>
                    <field name="state" widget="statusbar" statusbar_visible="draft,sent,sale"/>
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box">
                        <button name="action_view_invoice"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-pencil-square-o"
                            attrs="{'invisible': [('invoice_count', '=', 0)]}">
                            <field name="invoice_count" widget="statinfo" string="Invoices"/>
                        </button>
                    </div>
                    <div class="oe_title">
                        <h1>
                            <field name="name" readonly="1"/>
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="partner_id" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
                            <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
                            <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
                        </group>
                        <group>
                            <field name="date_order" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}"/>
                            <field name="validity_date" attrs="{'invisible': [('state', 'in', ['sale', 'done'])]}"/>
                            <field name="confirmation_date" attrs="{'invisible': [('state', 'in', ['draft', 'sent', 'cancel'])]}"/>
                            <field name="pricelist_id" groups="product.group_sale_pricelist"/>
                            <field name="currency_id" invisible="1"/>
                            <field name="payment_term_id" options="{'no_create': True}"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Order Lines">
                            <field name="order_line" mode="tree,kanban"
                                attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">
                                <form string="Sales Order Lines">
                                    <group>
                                        <group>
                                            <field name="product_id"
                                                context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
                                                attrs="{'readonly': ['|', ('qty_invoiced', '&gt;', 0), ('procurement_ids', '!=', [])]}"
                                               />
                                            <field name="layout_category_id" groups="sale.group_sale_layout"/>
                                            <field name="invoice_status" invisible="1"/>
                                            <field name="qty_to_invoice" invisible="1"/>
                                            <field name="qty_delivered_updateable" invisible="1"/>
                                            <field name="procurement_ids" invisible="1"/>
                                            <field name="price_subtotal" invisible="1"/>
                                            <label for="product_uom_qty" string="Ordered Quantity"/>
                                            <div>
                                                <field
                                                    context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'uom_qty_change':True, 'company_id': parent.company_id}"
                                                    name="product_uom_qty" class="oe_inline"/>
                                                <field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
                                                    attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"/>
                                            </div>
                                            <label for="qty_delivered" string="Delivered Quantity" invisible="context.get('hide_sale')"/>
                                            <div invisible="context.get('hide_sale')">
                                                <field name="qty_delivered" attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
                                            </div>
                                            <label for="qty_invoiced" string="Invoiced Quantity" invisible="context.get('hide_sale')"/>
                                            <div invisible="context.get('hide_sale')">
                                                <field name="qty_invoiced" invisible="context.get('hide_sale')"/>
                                            </div>
                                            <field name="price_unit"/>
                                            <label for="discount" groups="sale.group_discount_per_so_line"/>
                                            <div name="discount" groups="sale.group_discount_per_so_line">
                                                <field name="discount" class="oe_inline"/> %%
                                            </div>
                                        </group>
                                        <group>
                                            <field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
                                                attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"/>
                                            <label for="customer_lead"/>
                                            <div>
                                                <field name="customer_lead" class="oe_inline"/> days
                                            </div>
                                            <label for="analytic_tag_ids"/>
                                            <div>
                                                <field name="analytic_tag_ids" widget="many2many_tags"/>
                                            </div>
                                        </group>
                                    </group>
									<notebook>
										<page string="Optional addons" name="addons_optional"
											>
											<field name="optional_addons"
												>
												<form>
													<group>
														<field name="number" />
														<field name="product_id" />
														<field name="quantity"/>
														
													</group>
												</form>
												<tree editable="bottom">
													<field name="number" />
													<field name="product_id" />
													
													<field name="quantity"
														string="Quantity"/>
													
												</tree>
											</field>
										</page>
										<page string="Mandatory addons" name="addons_mandatory"
											>
											<field name="mandatory_addons"
												>
												<tree editable="bottom">
													<field name="number" />
													<field name="product_id" />
													
													<field name="quantity" />
													
												</tree>
												<form>
													<group>
														<field name="number"/>
														<field name="product_id"/>
														
														<field name="quantity"/>
														
													</group>
												</form>
											</field>
										</page>
									</notebook>
                                    <label for="name"/>
                                    <field name="name"/>
                                    <div groups="base.group_no_one">
                                        <label for="invoice_lines"/>
                                        <field name="invoice_lines"/>
                                    </div>
                                    <field name="state" invisible="1"/>
                                </form>
                                <tree string="Sales Order Lines" decoration-info="invoice_status=='to invoice'">
                                    
                                    <field name="product_id"
                                        attrs="{'readonly': ['|', ('qty_invoiced', '&gt;', 0), ('procurement_ids', '!=', [])]}"
                                        context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
                                       />
                                    <field name="layout_category_id" groups="sale.group_sale_layout"/>
                                    <field name="name"/>
                                    <field name="product_uom_qty"
                                        string="Ordered Qty"
                                        context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
                                    />
                                    <field name="qty_delivered" invisible="context.get('hide_sale')"
                                        attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
                                    <field name="qty_invoiced"
                                        invisible="context.get('hide_sale')"/>
                                    <field name="qty_to_invoice" invisible="1"/>
                                    <field name="product_uom"
                                        attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"
                                        context="{'company_id': parent.company_id}"
                                        groups="product.group_uom" options='{"no_open": True}'/>
                                    <field name="analytic_tag_ids" groups="analytic.group_analytic_accounting" widget="many2many_tags"/>
                                    <field name="price_unit"
                                        attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"/>
                                    <field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
                                        attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"/>
                                    <field name="discount" groups="sale.group_discount_per_so_line"/>
                                    <field name="price_subtotal" widget="monetary" groups="sale.group_show_price_subtotal"/>
                                    <field name="price_total" widget="monetary" groups="sale.group_show_price_total"/>
                                    <field name="qty_delivered_updateable" invisible="1"/>
                                    <field name="procurement_ids" invisible="1"/>
                                    <field name="state" invisible="1"/>
                                    <field name="invoice_status" invisible="1"/>
                                    <field name="customer_lead" invisible="1"/>
                                    <field name="currency_id" invisible="1"/>
                                </tree>
                                <kanban class="o_kanban_mobile">
                                    <field name="product_id"/>
                                    <field name="product_uom_qty"/>
                                    <field name="product_uom" groups="product.group_uom"/>
                                    <field name="price_subtotal"/>
                                    <templates>
                                        <t t-name="kanban-box">
                                            <div t-attf-class="oe_kanban_card oe_kanban_global_click">
                                                <div class="row">
                                                    <div class="col-xs-12">
                                                        <strong><span><t t-esc="record.product_id.value"/></span></strong>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-xs-8 text-muted">
                                                        <span><t t-esc="record.product_uom_qty.value"/> <t t-esc="record.product_uom.value"/></span>
                                                    </div>
                                                    <div class="col-xs-4 text-muted">
                                                        <span class="pull-right text-right"><t t-esc="record.price_subtotal.value"/></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </t>
                                    </templates>
                                </kanban>
                            </field>
                            <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
                                <field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                                <div class="oe_subtotal_footer_separator oe_inline o_td_label">
                                    <label for="amount_total" />
                                    <button name="button_dummy"
                                        states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>
                                </div>
                                <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                            </group>
                            <field name="note" class="oe_inline" placeholder="Setup default terms and conditions in your company settings."/>
                            <div class="oe_clear"/>
                        </page>
                        <page string="Other Information">
                            <group>
                                <group string="Sales Information" name="sales_person">
                                    <field name="user_id"/>
                                    <field name="team_id" options="{'no_create': True}"/>
                                    <field name="client_order_ref"/>
                                    <field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
                                    <field name="project_id" attrs="{'invisible':[('state','=','sale')]}" context="{'default_partner_id':partner_invoice_id, 'default_name':name}" groups="analytic.group_analytic_accounting"/>
                                    <field name="related_project_id"
                                           attrs="{'readonly': ['|',('project_id','!=',False),('invoice_count','!=',0),('state','=','sale')],'invisible':[('state','!=','sale')]}"
                                           context="{'default_partner_id':partner_invoice_id, 'default_name':name}"
                                           groups="analytic.group_analytic_accounting"/>
                                </group>
                                <group name="sale_pay" string="Invoicing">
                                    <field name="fiscal_position_id" options="{'no_create': True}"/>
                                    <field name="invoice_status"
                                        attrs="{'invisible': [('state', 'not in', ('sale','done'))]}"/>
                                </group>
                                <group string="Reporting" name="technical" groups="base.group_no_one">
                                    <field groups="base.group_no_one" name="origin"/>
                                </group>
                            </group>
                        </page>
                    </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
                </form>
            </field>
        </record>

		<record id="action_quotations_form" model="ir.actions.act_window.view">
			<field eval="1" name="sequence"/>
			<field name="view_mode">form</field>
			<field name="view_id" ref="view_quotation_form"/>
			<field name="act_window_id" ref="sale.action_quotations"/>
		</record>
		
		<record id="action_quotations_tree" model="ir.actions.act_window.view">
			<field eval="0" name="sequence"/>
			<field name="view_mode">tree</field>
			<field name="view_id" ref="sale.view_quotation_tree"/>
			<field name="act_window_id" ref="sale.action_quotations"/>
		</record>

		<record id="view_sale_optional_addons_form" model="ir.ui.view">
            <field name="name">sale.optional.addons.form</field>
            <field name="model">sale.optional.addons</field>
            <field name="arch" type="xml">
                <form string="Sales Optional Addons">
               
                <sheet>
					<group>
						<field name="number" />
						<field name="product_id" />
						<field name="quantity"/>
						
					</group>
				</sheet>
				</form>
            </field>
        </record>

		<record id="view_sale_optional_addons_tree" model="ir.ui.view">
            <field name="name">sale.optional.addons.tree</field>
            <field name="model">sale.optional.addons</field>
            <field name="arch" type="xml">
                <tree string="Sales Optional Addons">
					<field name="number" />
					<field name="product_id" />
					<field name="quantity"/>
				</tree>
            </field>
        </record>

</odoo>
0
Imagine profil
Abandonează
Ermin Trevisan

That's simply too much.

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
One2many field odoo version 10
one2many odoo10
Imagine profil
Imagine profil
1
sept. 22
2914
"RuntimeError: maximum recursion depth exceeded in cmp" problem
one2many odoo10
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
mai 18
12134
Prevent create and delete on a One2many tree view Rezolvat
treeview one2many odoo10
Imagine profil
1
iul. 20
9464
Update a field in all One2many lines when a line is added or removed
one2many onchange odoo10
Imagine profil
0
apr. 20
5019
How to search for records that have child records in One2many relation? Rezolvat
one2many search odoo10
Imagine profil
Imagine profil
1
ian. 20
4458
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