İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

[8] how to add field in a view from another?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
viewsfieldsproduct.productpurchase.orderproduct.template
3 Cevaplar
5599 Görünümler
Avatar
mauro anelli

hello,

1)i made some custom field in product.template, now i would like to get them in purchase order form view. any help?

2)it's possible to add the value of the field after another? for example i have product id, name, default_code ecc on product.template.product.form. now i would like that in purchase order, when i select a product , it fill the description with name+default_code


thanks

0
Avatar
Vazgeç
Avatar
Nikhil Krishnan
En İyi Yanıt

Hi aneli,
Its possible, 

In purchase module there is function

class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'

def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty,
uom_id, partner_id, date_order=False,
fiscal_position_id=False, date_planned=False,
name=False, price_unit=False, state='draft',
context=None):
res = super(PurchaseOrderLine, self).onchange_product_id(
cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id,
date_order=date_order, fiscal_position_id=fiscal_position_id,
date_planned=date_planned, name=name, price_unit=price_unit,
state=state, context=context)
         product_id = res['product_id']
         res['name'] = product_id.name + product_id.default_code
         # for addind  "x_IDfornitore" and x_IDfornitore2 fields
          res['name'] = product_id.name (if needed,) + product_id.x_IDfornitore + IDfornitore2
return res

** Please remove (if needed,) from code.

Please super this function and make what you want.

This is just a model, you can make it as you like. (Don't follow the exact code, its model)

If you need a correct code, you make your question more detailed.

Thank you, hope it will help you.

1
Avatar
Vazgeç
Avatar
mauro anelli
Üretici En İyi Yanıt

thanks very much and sorry but i'm really newbi to programmin.


when i get to change the code i found that the code you gave me is for odoo 9. in odoo 8 i found this

class purchase_order_line(osv.osv):

    def _calc_line_base_price(self, cr, uid, line, context=None):

        """Return the base price of the line to be used for tax calculation.

        This function can be extended by other modules to modify this base

        price (adding a discount, for example).

        """

        return line.price_unit

    def _calc_line_quantity(self, cr, uid, line, context=None):

        """Return the base quantity of the line to be used for the subtotal.

        This function can be extended by other modules to modify this base

        quantity (adding for example offers 3x2 and so on).

        """

        return line.product_qty

    def _amount_line(self, cr, uid, ids, prop, arg, context=None):

        res = {}

        cur_obj=self.pool.get('res.currency')

        tax_obj = self.pool.get('account.tax')

        for line in self.browse(cr, uid, ids, context=context):

            line_price = self._calc_line_base_price(cr, uid, line,

                                                    context=context)

            line_qty = self._calc_line_quantity(cr, uid, line,

                                                context=context)

            taxes = tax_obj.compute_all(cr, uid, line.taxes_id, line_price,

                                        line_qty, line.product_id,

                                        line.order_id.partner_id)

            cur = line.order_id.pricelist_id.currency_id

            res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])

        return res

    def _get_uom_id(self, cr, uid, context=None):

        try:

            proxy = self.pool.get('ir.model.data')

            result = proxy.get_object_reference(cr, uid, 'product', 'product_uom_unit')

            return result[1]

        except Exception, ex:

            return False

    _columns = {

        'name': fields.text('Description', required=True),

        'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True),

        'date_planned': fields.date('Scheduled Date', required=True, select=True),

        'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes', domain=['|', ('active', '=', False), ('active', '=', True)]),

        'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True),

        'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),

        'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'),

        'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')),

        'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')),

        'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'),

        'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),

        'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),

        'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')],

ecc ecc


it's similar or i need to write a different code?


thank

0
Avatar
Vazgeç
Nikhil Krishnan

Hai friend, i think In the XML you did not make any change, so you need to add this 2 values( "x_IDfornitore" and x_IDfornitore2) in name field in purchase order,

So you just check my above answer once more, i will rewrite it for you, please check that this fields ( "x_IDfornitore" and x_IDfornitore2) defined in product.template. ok

mauro anelli
Üretici

i'm sorry but the function you gave me is in the purchase.py from odoo 9. i change my answare with the code i found in odoo 8 versione of purchase.py. i don't if it's the same

mauro anelli
Üretici

on odoo 8 this function "class PurchaseOrderLine(models.Model)" is different . it's purchase_order_line(osv.osv) ecc. the code still works or i need a different one?

thanks

Avatar
Rafael Aguero Baquero
En İyi Yanıt

Of course it's possible. You need to make an inheritance of purchase.order.line for rewrite the onchange_product_id method, in this method you can put into description field anything you want.

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
isn't standard_price must be depend on the product.product?
fields product.product prices product.template
Avatar
Avatar
1
Ara 15
4714
Add purchase order field to product template
fields odoo api.depends purchase.order product.template
Avatar
Avatar
1
Ağu 23
2996
How to add a field in product.product after made some changes in product template ?
v8 fields inherit product.product product.template
Avatar
Avatar
1
Kas 15
12231
What is the way that product.product and product.template synchronize data? Çözüldü
product.product product.template
Avatar
Avatar
Avatar
2
Ağu 23
6144
Making a variantproduct from existing product templates
product.product product.template
Avatar
0
Eki 21
2377
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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