← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 787256] Re: importing a bad csv file in module, and subsequent correction causes issues

 

Thanks for pointing out.  I've pushed a new revision

On Fri, Jun 3, 2011 at 9:41 PM, Vinay Rana (openerp) <
787256@xxxxxxxxxxxxxxxxxx> wrote:

> Hello Graeme Gellatly,
>
> I have found one minor problem in your chart of account module. due to
> that problem I am not able to install your module. The following patch
> will solve the problem:
>
> === modified file 'l10n_nz/data/account.tax.template.csv'
> --- l10n_nz/data/account.tax.template.csv       2011-05-23 05:45:48 +0000
> +++ l10n_nz/data/account.tax.template.csv       2011-06-03 09:34:04 +0000
> @@ -1,9 +1,9 @@
>
>  "id","description","chart_template_id:id","type_tax_use","name","type","amount","account_collected_id:id","account_paid_id:id","base_code_id:id","tax_code_id:id","ref_base_code_id:id","ref_tax_code_id:id","ref_base_sign","ref_tax_sign","parent_id:id","python_compute"
> -"ST1","ST1","l10n_nz_ext","sale","Standard rate sales
> (15.0%)","code","0.15","21310","21310","5","1","5","1","-1","-1",,"result =
> price_unit * 0.15"
> -"PT1","PT1","l10n_nz_ext","purchase","Standard rate purchases
> (15.0%)","code","0.15","21320","21320","6","3","6","3","-1","-1",,"result =
> price_unit * 0.15"
> -"ST0","ST0","l10n_nz_ext","sale","Zero rated
> sales","percent","0","21310","21310","5","1","5","1","-1","-1",,
> -"ST2","ST2","l10n_nz_ext","sale","Exempt
> sales","percent","0","21310","21310","5","1","5","1","-1","-1",,
> -"PT0","PT0","l10n_nz_ext","purchase","Zero rated
> purchases","percent","0","21320","21320","6","3","6","3","-1","-1",,
> -"PT2","PT2","l10n_nz_ext","purchase","Exempt
> purchases","percent","0","21320","21320","6","3","6","3","-1","-1",,
> -"ST11","ST11","l10n_nz_ext","sale","Old rate sales
> (12.5%)","percent","0.125","21310","21310","5","1","5","1","-1","-1",,
> -"PT11","PT11","l10n_nz_ext","purchase","Old rate purchases
> (12.5%)","percent","0.125","21320","21320","6","3","6","3","-1","-1",,
> +"ST1","ST1","l10n_nz_std","sale","Standard rate sales
> (15.0%)","code","0.15","21310","21310","5","1","5","1","-1","-1",,"result =
> price_unit * 0.15"
> +"PT1","PT1","l10n_nz_std","purchase","Standard rate purchases
> (15.0%)","code","0.15","21320","21320","6","3","6","3","-1","-1",,"result =
> price_unit * 0.15"
> +"ST0","ST0","l10n_nz_std","sale","Zero rated
> sales","percent","0","21310","21310","5","1","5","1","-1","-1",,
> +"ST2","ST2","l10n_nz_std","sale","Exempt
> sales","percent","0","21310","21310","5","1","5","1","-1","-1",,
> +"PT0","PT0","l10n_nz_std","purchase","Zero rated
> purchases","percent","0","21320","21320","6","3","6","3","-1","-1",,
> +"PT2","PT2","l10n_nz_std","purchase","Exempt
> purchases","percent","0","21320","21320","6","3","6","3","-1","-1",,
> +"ST11","ST11","l10n_nz_std","sale","Old rate sales
> (12.5%)","percent","0.125","21310","21310","5","1","5","1","-1","-1",,
> +"PT11","PT11","l10n_nz_std","purchase","Old rate purchases
> (12.5%)","percent","0.125","21320","21320","6","3","6","3","-1","-1",,
>
>
> Thanks.
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/787256
>
> Title:
>  importing a bad csv file in module, and subsequent correction causes
>  issues
>
> Status in OpenERP Server:
>  New
>
> Bug description:
>  There are a few strands to this.  Some I can't confirm except to say
>  they occur on my machine.  I'm not even sure what the bug is I'm
>  reporting.
>
>  1. If the relative path of a symlink includes a hyphen then I think
>  the import doesn't work.  It chucks a no reference error in the
>  client.  On checking, this is because there are no entries in
>  ir.model.data when _get_id is called, the code excepts, silently
>  passes and continues.  Often this means the error at the end is in no
>  way related to the actual error, as it excepts all the way through,
>  but doesn't raise immediately so the exception gets overwritten.  I
>  think the csv importer deals with it fine, so when debugging you see
>  the right lines in the right place.  I think the issue might be where
>  ir.model.data gets populated.  I seem to remember that xml has an
>  issue with hyphens from when installing the bzr-xmloutput plugin for
>  bazaar where you need to rename the directory with an underscore.
>
>  2. Upon doing a number of things, like renaming the directory,
>  reformatting all csv's so everything was stored as strings in double
>  quotes, it still failed on an existing database (updated) but would
>  work fine on a fresh database.  Somehow it exhibits the same behaviour
>  where ir.model.data search returns an empty list.  So maybe some entry
>  is left over.  Deleting the module entry in GUI, and then restarting
>  the server and updating the modules it worked.
>
>  3. This behaviour is not limited to the hyphen problem.  I had an
>  entry called Travel, Meals and Entertainment in the chart, it was not
>  enclosed in quotes.  This brought about a quite correct error of no
>  reference to parent xxx.Meals and Entertainment.  However after
>  correcting the csv's it starts to exhibit the above error.
>
>  4. There is additional behaviour that is exhibited sometimes, if the
>  file is corrected without following the above steps.  And that is that
>  it will just not import anything at all, and start any configuration
>  actions.
>
>  I have experienced on latest 6.0.2 sources (as of yesterday) on Linux,
>  and have user reports confirmed on Windows as well.  The best way to
>  see this behaviour is to set a breakpoint at line 733 or 735 (or the
>  exception line) in the ORM within _get_id function and step over,
>  while using a bad csv file or directory.
>
>  I'm not concerned that it kicks up a fuss about bad csv files and
>  stupid developer symlinks and chucks an error, but that it is so
>  difficult to recover after correcting - and I think the bug is more
>  related to ir.model.data than csv import.  Maybe just throw an
>  exception if a hyphen is in the path.
>
>  While I highly do not recommend this, if you want files to test, good
>  files is latest rev of lp:~gdgellatly/openerp-au/l10n-nz-minimal-coa,
>  bad files is rev 3 of the same.  Just do it on something you don't
>  mind breaking (a fresh database is fine).
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/openobject-server/+bug/787256/+subscribe
>

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/787256

Title:
  importing a bad csv file in module, and subsequent correction causes
  issues

Status in OpenERP Server:
  New

Bug description:
  There are a few strands to this.  Some I can't confirm except to say
  they occur on my machine.  I'm not even sure what the bug is I'm
  reporting.

  1. If the relative path of a symlink includes a hyphen then I think
  the import doesn't work.  It chucks a no reference error in the
  client.  On checking, this is because there are no entries in
  ir.model.data when _get_id is called, the code excepts, silently
  passes and continues.  Often this means the error at the end is in no
  way related to the actual error, as it excepts all the way through,
  but doesn't raise immediately so the exception gets overwritten.  I
  think the csv importer deals with it fine, so when debugging you see
  the right lines in the right place.  I think the issue might be where
  ir.model.data gets populated.  I seem to remember that xml has an
  issue with hyphens from when installing the bzr-xmloutput plugin for
  bazaar where you need to rename the directory with an underscore.

  2. Upon doing a number of things, like renaming the directory,
  reformatting all csv's so everything was stored as strings in double
  quotes, it still failed on an existing database (updated) but would
  work fine on a fresh database.  Somehow it exhibits the same behaviour
  where ir.model.data search returns an empty list.  So maybe some entry
  is left over.  Deleting the module entry in GUI, and then restarting
  the server and updating the modules it worked.

  3. This behaviour is not limited to the hyphen problem.  I had an
  entry called Travel, Meals and Entertainment in the chart, it was not
  enclosed in quotes.  This brought about a quite correct error of no
  reference to parent xxx.Meals and Entertainment.  However after
  correcting the csv's it starts to exhibit the above error.

  4. There is additional behaviour that is exhibited sometimes, if the
  file is corrected without following the above steps.  And that is that
  it will just not import anything at all, and start any configuration
  actions.

  I have experienced on latest 6.0.2 sources (as of yesterday) on Linux,
  and have user reports confirmed on Windows as well.  The best way to
  see this behaviour is to set a breakpoint at line 733 or 735 (or the
  exception line) in the ORM within _get_id function and step over,
  while using a bad csv file or directory.

  I'm not concerned that it kicks up a fuss about bad csv files and
  stupid developer symlinks and chucks an error, but that it is so
  difficult to recover after correcting - and I think the bug is more
  related to ir.model.data than csv import.  Maybe just throw an
  exception if a hyphen is in the path.

  While I highly do not recommend this, if you want files to test, good
  files is latest rev of lp:~gdgellatly/openerp-au/l10n-nz-minimal-coa,
  bad files is rev 3 of the same.  Just do it on something you don't
  mind breaking (a fresh database is fine).


References