Odoo Help

2

1
4 Answers
1
Matthew Fournier United States
6/28/13, 1:45 PM

Felt like this warranted an answer, rather than a comment.

First, in screens.js, in the finishOrder function, add this line after the destroy() call that's already there:

$.when(this.pos.load_server_data());

This will cause the program to wait until the server data is all loaded before continuing. This kills the null errors, but causes a few quirks. The first and most annoying is that the categories get added in again whenever you make a new order, so go into db.js, and find the add_categories function. At the top of the function (Just after the self declaration) add this:

this.category_childs = {};

To reset them. Another problem is that the view doesn't refresh automatically. After you go to the products page, there will be a bit of a delay, a loading circle, and then you'll still be on the same page. This solution is a bit of a hackjob, but I'll update it if I find a more elegant solution.

First step is find every line of "this.product_categories_widget" and replace it with "this.pos.product_categories_widget" This will let us find the widget through the pos object in the FinishOrder button. There, replace your finishOrder function with this one:

       finishOrder: function() {
        var self = this;
        this.pos.get('selectedOrder').destroy();
        $.when(this.pos.load_server_data())
        .done(function() {  
            self.pos.product_categories_widget.reset_category();
            }).fail(function() {
        });
        },

There's still a gap between making a sale and the view updating, but it will refresh with no button presses from you, and you're ready to sell again right away. As fast as I tried, I couldn't "beat" the loading with a new sale, so that might be a problem with the solution, but it should reload properly every time in normal use.

1 Comment
matheus Brazil
8/8/13, 6:23 PM

From Matthew to Matthew, thanks very much! I'm terribly sorry for taking so long for marking this brilliant suggestion as an answer, this is a very good solution. I tottaly forgot my profile here after a few delusions, now faith in help.openerp is restored!

1
Avatar

swapnil wagh India

--swapnil wagh--
1594
| 6 5 10
Pune, India
--swapnil wagh--

My name is Swapnil A. Wagh. I studied Master Of computer Science and work as a Software Engineer. I’m a technology enthusiast and always eager to learn new and exciting technologies. I’m constantly looking for innovative solutions to age-old problems that push the limits of what we conceive to be possible.

swapnil wagh India
4/27/13, 7:45 AM

Hi matheus,

Write this this.pos = new module.PosModel(this.session); line on Next Order button click code it will fetch newly added Products, Partners for next order.

5 Comments
matheus Brazil
4/27/13, 11:45 AM

Hi swapnil, it's a brilliant idea! And for me as it looks it would work right away, but guess i must be doing something wrong.. you're talking about the screen.js file right? My line after the modification looks like this

> click: function() { self.finishOrder(); this.pos = new module.PosModel(this.session); },

But it's not doing anything, i've trying all kinds of syntax variations.. is this working for you? Thanks a lot for your help!

swapnil wagh India
4/27/13, 12:15 PM

Hi Matheus,

You just write the code on wrong place there is method finishOrder() just below the click: function() { self.finishOrder();}, this put the code this.pos = new module.PosModel(this.session); in that function... Hope this will work for you

Cheers, swapnil

matheus Brazil
4/27/13, 12:54 PM

I've made the correction now it looks like this: finishOrder: function() { this.pos.get('selectedOrder').destroy(); this.pos = new module.PosModel(this.session); }, BUT i get this error whenenever i press any button on the screen 'Uncaught Error: QWeb2 - template['PosTicket']: Runtime Error: TypeError: Cannot read property 'attributes' of null' and still it's not loading recently add products.. any suggestion swapnil?

Matthew Fournier United States
6/24/13, 4:58 PM

If you're still around, I am also having trouble getting your code to work. Getting the same error.

Matthew Fournier United States
6/27/13, 3:40 PM

Okay, so, I've done more research, and even though I haven't gotten it working, maybe if I post my findings it could help you.

The problem is in the loading of the database. The program keeps running while it waits for the data to load, so when it reloads the XML file, there's no data. I've tried to block the function until it's done loading, then manually reload the XML file, but I've been unsuccessful. I'm not sure how to wait on making the POS object, as it doesn't return a deferred, but calls a function that does. I need to do more research on asynchronous javascript.

1
Avatar

Navrang Oza India

--Navrang Oza--
Navrang Oza
853
| 3 2 8
Gandhinagar, India
--Navrang Oza--

Having 13+ years of experience in Odoo, Magento, Wordpress, Android, PHP Expert.

Skype : acespritech

Email : info@acespritech.com

Navrang Oza India
5/23/13, 7:18 AM

Hello !

It is possible to update product list but we have to reload it manually.
As you can see in attached image, we are updating Quantity on Hand run time after completion of order process.

pos.png

Thanks,
Acespritech Solutions Pvt. Ltd.
www.acespritech.com
Blog: acespritechblog.wordpress.com
Mail: info@acespritech.com
Skype: acespritech
Gtalk: acespritech

1 Comment
Matthew Fournier United States
6/24/13, 4:45 PM

I see you guys post on a bunch of different questions but you never seem to explain how to do anything. You just direct people to your blog which pretty much says "we did this" but you don't post code or anything. I get that you guys figured out how to solve this problem, but it's not really helping us with the same problem, now is it?

0
matheus Brazil
4/27/13, 11:44 AM

Hi swapnil, it's a brilliant idea! And for me as it looks it would work right away, but guess i must be doing something wrong.. you're talking about the screen.js file right? My line after the modification looks like this

click: function() { self.finishOrder(); this.pos = new module.PosModel(this.session); },

But it's not doing anything, i've trying all kinds of syntax variations.. is this working for you? Thanks a lot for your help!

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now