Bahmni Sale Discount addon OpenERP bug

Does anyone have any idea why the invoice payment for supplier in OpenERP that comes with Bahmni is slightly different with the normal OpenERP ? Below is the screenshot from both

Bahmni OpenERP (Version 7.0-20130301-002301)

Normal OpenERP (Version 7.0-20130102-002519)

I notice there are two main differences here.

  1. On normal OpenERP, the invoice payment UI is on a new pop up box. While for Bahmni OpenERP is on a new page.
  2. On normal OpenERP, the payment amount is 13 (positive) while on Bahmni OpenERP is -13 (negative).

Is this some misconfiguration on my side ? Any information on this is very much appreciated.

I solved the negative issue by removing Bahmni Sales Discount addon from OpenERP.


However removing this addon cause the atom feed sync to fail at least from bahmni to openerp Below is the error message

Failed processing event in feed [http://localhost:8050/openmrs/ws/atomfeed/encounter/7] java.lang.RuntimeException: No such external ID currently defined in the system: bahmni_sale_discount.group_default_quantity Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/service/", line 82, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/", line 295, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/service/", line 614, in dispatch res = fn(db, uid, *params) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/osv/", line 131, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/osv/", line 198, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/osv/", line 185, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 108, in process_event self.pool.get('').create_orders(cr,uid,vals,context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 297, in create_orders self._create_sale_order(cr, uid, cus_id, name, unprocessed_non_dispensed_order[0]['custom_shop_id'], unprocessed_non_dispensed_order, care_setting, provider_name, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 163, in _create_sale_order self._process_orders(cr, uid, name, sale_order, orders, order, context=context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 143, in _process_orders self._create_sale_order_line(cr, uid, name, sale_order, order, context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 23, in _create_sale_order_line self._create_sale_order_line_function(cr, uid, name, sale_order, order, context=context) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_atom_feed/", line 47, in _create_sale_order_line_function default_quantity_object = self.pool.get('').get_object_reference(cr, uid, 'bahmni_sale_discount', 'group_default_quantity')[1] File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/tools/", line 18, in lookup r = self.lookup(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/tools/", line 46, in lookup value = d[key] = self.method(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/base/ir/", line 865, in get_object_reference data_id = self._get_id(cr, uid, module, xml_id) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/tools/", line 18, in lookup r = self.lookup(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/tools/", line 46, in lookup value = d[key] = self.method(self2, cr, *args) File "/usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/base/ir/", line 858, i

So I think now I am left with 2 options.

  1. Wait for the addon to get fixed. Is this bug known to the addon developer? How do I submit a bug on this?

  2. I try to fix the addon myself. Where do I start on this?

Does anyone use the purchase order feature in OpenERP ?

  1. Create PO and confirm PO
  2. Receive Invoice
  3. Pay invoice
  4. Check the journal entries if the amount is correct for each affected account

Id like to know if this issue only appears on my side or not.

Please help. Thx

I fixed this by reverting a portion of the code in openerp/addons/bahmni_sale_discount/

def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines, context=None):
        if context is None:
    total = 0
    total_currency = 0
    cur_obj = self.pool.get('res.currency')
    for i in invoice_move_lines:
        if != company_currency:
            context.update({'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
            i['currency_id'] =
            i['amount_currency'] = i['price']
            i['price'] = cur_obj.compute(cr, uid,,
                                         company_currency, i['price'],
            i['amount_currency'] = False
            i['currency_id'] = False
        i['ref'] = ref
        if inv.type in ('out_invoice','in_refund'):
            total += i['price']
            total_currency += i['amount_currency'] or i['price']
            i['price'] = - i['price']
            total -= i['price']
            total_currency -= i['amount_currency'] or i['price']
    return total, total_currency, invoice_move_lines