Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Calculate Product Cost Price through BoM

Subscriure's

Get notified when there's activity on this post

This question has been flagged
v8mrpcost_pricebom
1 Respondre
10276 Vistes
Avatar
Herman

I use Average pricing so that my raw materials' cost will be updated with each Purchase. But how do I make my Product's price with BoMs update according to materials/products price updates? I have over 200 000 thousand products, so this cant be done manually

0
Avatar
Descartar
Avatar
E.R. Spada
Best Answer

We created a cron in v8 to update standard cost with bom, it is the only way. I have no idea why this is not built in. We extended the product_extended_module, here is the function:

class product_template(osv.osv):

_name = 'product.template'

_inherit = 'product.template'


Here is the wizard:

from openerp.exceptions import except_orm

from openerp.osv import fields, osv

from openerp.tools.translate import _

class wizard_price(osv.osv):

_name = "wizard.price"

_description = "Compute price wizard"

_columns = {

'info_field': fields.text('Info', readonly=True),

'real_time_accounting': fields.boolean("Generate accounting entries when real-time"),

'recursive': fields.boolean("Change prices of child BoMs too"),

}

def default_get(self, cr, uid, fields, context=None):

res = super(wizard_price, self).default_get(cr, uid, fields, context=context)

product_pool = self.pool.get('product.template')

product_obj = product_pool.browse(cr, uid, context.get('active_id', False))

if context is None:

context = {}

rec_id = context and context.get('active_id', False)

assert rec_id, _('Active ID is not set in Context.')

res['info_field'] = str(product_pool.compute_price(cr, uid, [], template_ids=[product_obj.id], test=True, context=context))

return res

def compute_from_bom(self, cr, uid, ids, context=None):

assert len(ids) == 1

if context is None:

context = {}

model = context.get('active_model')

if model != 'product.template':

raise except_orm(_('Wrong model!'), _('This wizard is build for product templates, while you are currently running it from a product variant.'))

rec_id = context and context.get('active_id', False)

assert rec_id, _('Active ID is not set in Context.')

prod_obj = self.pool.get('product.template')

res = self.browse(cr, uid, ids, context=context)

prod = prod_obj.browse(cr, uid, rec_id, context=context)

prod_obj.compute_price(cr, uid, [], template_ids=[prod.id], real_time_accounting=res[0].real_time_accounting, recursive=res[0].recursive, test=False, context=context)

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

print "-------------------------------schedular calling-------------------------------------------"

template_ids = self.search(cr,uid, [("cost_method","=","standard")])

print "template_ids----",template_ids

if template_ids:

self.compute_price(cr, uid, [],template_ids=template_ids, recursive=True, test=False, real_time_accounting = False, context=None)

return True

def compute_price(self, cr, uid, product_ids, template_ids=False, recursive=False, test=False, real_time_accounting = False, context=None):

'''

Will return test dict when the test = False

Multiple ids at once?

testdict is used to inform the user about the changes to be made

'''

testdict = {}

if product_ids:

ids = product_ids

model = 'product.product'

else:

ids = template_ids

model = 'product.template'

if not ids:

return True

for prod_id in ids:

bom_obj = self.pool.get('mrp.bom')

if model == 'product.product':

bom_id = bom_obj._bom_find(cr, uid, product_id=prod_id, context=context)

else:

bom_id = bom_obj._bom_find(cr, uid, product_tmpl_id=prod_id, context=context)

if bom_id:

# In recursive mode, it will first compute the prices of child boms

if recursive:

#Search the products that are components of this bom of prod_id

bom = bom_obj.browse(cr, uid, bom_id, context=context)

#Call compute_price on these subproducts

prod_set = set([x.product_id.id for x in bom.bom_line_ids])

res = self.compute_price(cr, uid, list(prod_set), recursive=recursive, test=test, real_time_accounting = real_time_accounting, context=context)

if test:

testdict.update(res)

#Use calc price to calculate and put the price on the product of the BoM if necessary

price = self._calc_price(cr, uid, bom_obj.browse(cr, uid, bom_id, context=context), test=test, real_time_accounting = real_time_accounting, context=context)

if test:

testdict.update({prod_id : price})

if test:

return testdict

else:

return True

-1
Avatar
Descartar
Emipro Technologies Pvt. Ltd.

No one can even understand your answer. Please use "Code" style from editor.

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Subcontracting Product with multiple BoM
mrp bom
Avatar
0
d’oct. 25
1640
BOM with some item quantity which not depends of the whole quantity to produce Solved
mrp bom
Avatar
Avatar
1
de juny 25
5504
How to show BOM matrix with quantity of used product?
mrp bom
Avatar
0
de febr. 19
4576
Discrepancy between MRP Cost Report and Compute From BOM Calculation
mrp bom
Avatar
0
de nov. 18
4115
BOM cost - odoo 8 online -
cost_price bom
Avatar
Avatar
Avatar
3
d’ag. 17
6088
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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