Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4109 Tampilan

When creating a purchase order, if you happen to change the price first then quantity or unit of measure after, the price will reset back to what it was before you changeg it (default price or 0.0). It have something to do with the onchange_product_id function but, cannot figure out what exactly creates this.

here is the code of the function (with non relevent code removed) :

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, context=None):

    if context is None:
        context = {}

    res = {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}}
    if not product_id:
        return res

    product_product = self.pool.get('product.product')
    product_uom = self.pool.get('product.uom')
    product_pricelist = self.pool.get('product.pricelist')

 ....

    if pricelist_id:
        price = product_pricelist.price_get(cr, uid, [pricelist_id],
                product.id, qty or 1.0, partner_id or False, {'uom': uom_id, 'date': date_order})[pricelist_id]
    else:
        price = product.standard_price

....

    res['value'].update({'price_unit': price, 'taxes_id': taxes_ids})

    return res

product_id_change = onchange_product_id
product_uom_change = onchange_product_uom

What cause that behavior and how to modify it to keep the price entered by the user at any time ? (This has been like that since at least V.6)

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Mar 15
9846
0
Mar 15
4009
3
Agu 25
463
1
Nov 24
4194
1
Sep 23
6474