bugGNU Health - Bugs: bug #41382, 'Application Error' on Creating...


You are not allowed to post comments on this tracker with your current authentication level.

bug #41382: 'Application Error' on Creating New Stock Move

Submitted by:  Selvakumar <vselva>
Submitted on:  Wed 29 Jan 2014 08:36:15 AM UTC  
Category:  Functionality Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  None
Module:  Inventory & Stock

( Jump to the original submission)

Wed 13 May 2015 10:53:08 AM UTC, comment #6: 

Excellent, Chris !

Thanks a lot for documenting the functionality, and steps !

The read-only feature for stock moves views is great. I will update today the dev. demo DB with these features.


Luis Falcon <meanmicio>
Project Administrator
Wed 13 May 2015 01:49:21 AM UTC, comment #5: 

Just updated the docs with stock move information.



Also, I pushed a commit to add [readonly] to the page titles. Hopefully, that will provide some clarification. I'll mark as fixed and close. I suppose we may have to tackle this general issue again. Hehe.

Chris Zimmerman <teffalump>
Project Member
Tue 12 May 2015 02:56:54 AM UTC, comment #4: 

Hiya Luis!

Thanks for the clarification!

I think documenting this behavior is a great idea because there are a few bug reports about the Related Records actions. I mean, it makes more sense from a developer standpoint why it's read-only.

Changing the name, I think, would clarify it to users. Maybe change the page title, too -- like Stock Moves [read-only] or similar. However, I still think we'll get bug reports about this problem because many views aren't truly read-only, since you can try to create a new record. Other than deleting the domain and allowing a clean view, I don't see an easy solution.

Thanks again.

Chris Zimmerman <teffalump>
Project Member
Mon 11 May 2015 10:49:44 AM UTC, comment #3: 


We created the wizard so the stock moves are generated from the information given in the main prescription / vaccination view.

So, the related records in these models are only to view NOT to generate the moves. As you said, this is done in the stock move wizard .

Since Tryton 3.2, the domain in relate actions has been limited to active_ids . This is part of the reason we use wizard to create the stock move and to create the patient evaluation from the appointment.

Check http://savannah.gnu.org/bugs/?43111

We should document the functionality on the wiki and close the bug. Probably, we should also call the related records action "View stock moves" to be more explicit about the purpose.


Luis Falcon <meanmicio>
Project Administrator
Mon 11 May 2015 12:54:32 AM UTC, comment #2: 

This issue is one of a series of issues with form_relate and domains (with similar bug reports). Put simply, you should create new stock moves by means of the wizard: Actions > Create Prescription/Vaccination Stock Move. On the technical side, the Related Records function defines a domain/filter for the Stock Moves view, in order to only show the related stock move. However, when you try to create a new record from that view, the domain is still active, consequently some weird stuff happens (errors). I'm not entirely clear why. Nevertheless, you can create new stock moves from the default view (no domain defined). A simple fix is to remove the domain, so the shortcut is to the default view of Stock Moves, then the user can filter down to what they are looking for. However, you lose the ability to immediately see the related Stock Move (if it exists). Another possibility is to define a search_value (for the search bar) that will display only Stock Moves from that model (can't seem to make this search specific enough to display the single stock move related to the prescription/vaccination). To be honest, I think removing the domain would alleviate some confusion. Or even removing the related records function altogether. In general, I'm finding that form_relate (Related Records) oftentimes produces confusing behavior. Thoughts?

Chris Zimmerman <teffalump>
Project Member
Sun 26 Apr 2015 05:51:14 AM UTC, comment #1: 

Still occurs. Looking into it.

Chris Zimmerman <teffalump>
Project Member
Wed 29 Jan 2014 08:36:15 AM UTC, original submission:  


I am testing GNU Health on demo server as following:

Server: health.gnusolidario.org:8000
Database: health24rc1
User name: admin
Password: gnusolidario
Tryton version: 3.0.2


When I tried to create a stock move as follows, I got 'Application Error' Message window:

1. Prescriptions
2. Select one prescriptions (here in demo server I selected PRES 2013/000002)
3. Open Related Records (in top menu bar)
4. Create New Record (from top menu bar)
5. Select 'Origin' as 'Patient Ambulatory Care' and then 'Open New Record'.

This give 'Application Error' as follows:



Traceback (most recent call last):
  File "/trytond/protocols/jsonrpc.py", line 123, in _marshaled_dispatch
    response['result'] = dispatch_method(method, params)
  File "/trytond/protocols/jsonrpc.py", line 156, in _dispatch
    res = dispatch(*args)
  File "/trytond/protocols/dispatcher.py", line 169, in dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelsql.py", line 871, in search
    tables, expression = cls.search_domain(domain)
  File "/trytond/model/modelsql.py", line 1044, in search_domain
    expression = convert(domain)
  File "/trytond/model/modelsql.py", line 1042, in convert
    domain[1:] if domain[0] == 'AND' else domain)))
  File "/trytond/model/modelsql.py", line 1041, in <genexpr>
    return And((convert(d) for d in (
  File "/trytond/model/modelsql.py", line 1032, in convert
    expression = field.convert_domain(domain, tables, cls)
  File "/trytond/model/fields/field.py", line 237, in convert_domain
    name, operator, value = domain
ValueError: too many values to unpack

Selvakumar <vselva>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by meanmicio (Posted a comment)
  • -email is unavailable- added by teffalump (Posted a comment)
  • -email is unavailable- added by vselva (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-13 teffalump StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2015-05-12 teffalump StatusWorks For Me => In Progress
    2015-05-11 meanmicio StatusIn Progress => Works For Me
    2015-05-11 teffalump CategoryDemo environment => Functionality
    2015-04-26 teffalump StatusNone => In Progress

    Back to the top

    Powered by Savane 3.7