Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #27454 Back to Issue ]
Summary 0027454: Tax Exempt module does not work with q4 version, sql replacement seems to simple
Revision 2014-08-24 22:36 by mtaal
Steps To Reproduce Install taxexempt module with the q4 version and run it.
Revision 2014-08-24 22:36 by mtaal
Description I found 2 problems.
First:
I changed a line to this, this seems to work, the original line in the modeule is this:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.taxexempt/file/d46b6b9cc1fc/web/org.openbravo.retail.taxexempt/js/taxExemptButton.js#l80 [^]
I changed it to this:
  if (componentHolder && componentHolder.name === 'defaultEdit' && componentHolder.components[0] && componentHolder.components[0].name === 'msgedit' && componentHolder.components[0].components[0] && componentHolder.components[0].components[0].components && componentHolder.components[0].components[0].components.push) {

But this must be validated.

Second:
This code:
  OB.UTIL.HookManager.registerHook('OBPOS_FindTaxRate', function (args, callbacks) {
    if (args.context.get('bp').get('taxExempt')) {
      args.line.set('taxExempt', true);
    } else if (args.line.get('taxExempt')) {
      args.sql = "select * from c_tax where istaxexempt = 'true' order by validfrom desc limit 1";
    }
    OB.UTIL.HookManager.callbackExecutor(args, callbacks);
    return;
  });

Fails because the args does not have a property line. This got solved in this push:
http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/ad8bc428c9f8318c2953ecd4d441551c507414a5 [^]

A bigger problems seems to be that the sql replacement proposed above does not seem to be correct, the sql query which gets replaced is really big and the replacement does not seem to cover all cases, it seems better to add the istaxexempt=true to the query.

So this issue is 2 things:
- validate that the first topic has been solved correctly
- check the sql replacement
Revision 2014-08-24 22:26 by mtaal
Steps To Reproduce Install taxexempt module with the q4 version.
Revision 2014-08-24 22:26 by mtaal
Description I found 2 problems.
First:
I changed a line to this, this seems to work, the original line in the modeule is this:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.taxexempt/file/d46b6b9cc1fc/web/org.openbravo.retail.taxexempt/js/taxExemptButton.js#l80 [^]
I changed it to this:
  if (componentHolder && componentHolder.name === 'defaultEdit' && componentHolder.components[0] && componentHolder.components[0].name === 'msgedit' && componentHolder.components[0].components[0] && componentHolder.components[0].components[0].components && componentHolder.components[0].components[0].components.push) {


Second:
This code:
  OB.UTIL.HookManager.registerHook('OBPOS_FindTaxRate', function (args, callbacks) {
    if (args.context.get('bp').get('taxExempt')) {
      args.line.set('taxExempt', true);
    } else if (args.line.get('taxExempt')) {
      args.sql = "select * from c_tax where istaxexempt = 'true' order by validfrom desc limit 1";
    }
    OB.UTIL.HookManager.callbackExecutor(args, callbacks);
    return;
  });

Fails because the args does not have a property lines. A bigger problems seems to be that the sql replacement proposed above does not seem to be correct, the sql query which gets replaced is really big and the replacement does not seem to cover all cases, it seems better to add the istaxexempt=true to the query.

The hook should also be changed to also send the line to the hooks. Will do that.



Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker