Community mailing list archives

community@mail.odoo.com

Re: Odoo 9 POS Inheritance issue

by
LMS
- 02/15/2016 11:17:23

Hi Sylvain,


For some reason I dont understand, this is not working.

modscreen.ClientListScreenWidget.include({});

What it does work is this :

modscreen.ClientListScreenWidget = modscreen.ClientListScreenWidget.include({});


Thanks a lot,


Luis Miguel

El feb 15, 2016 4:24 AM, "Sylvain LE GAL" <sylvain.legal@grap.coop> escribió:
Hi Luis,

V8 / V9 :
well, it works on OCB 9.0 and Odoo 9.0 (The OpenSource Version. I did not tested on the Closed source version).

You can see the target version at the top of the PR :
Images intégrées 1

About your bug, do you have a stable version without any custom code ?

Because, I believe that your bug is not related to the returned value. The code below should work.

var modscreen = require('point_of_sale.screens');
modscreen.ClientListScreenWidget.include({});

kind regards.

Sylvain LE GAL
Service informatique
GRAP - Groupement Régional Alimentaire de Proximité

3 Grande rue des Feuillants, 69001 Lyon
Bureau :
(+33) 09.72.32.33.17
Astreinte :
(+33) 06.81.85.61.43

GRAP sur le Web : Site Web | Facebook | Twitter
GRAP - service Informatique sur le Web : Twitter


2016-02-14 4:36 GMT+01:00 Luis Miguel Sarabia <luismiguel.sarabia@gmail.com>:
Sylvain,

Is the code sent in the link for v9? It looks as it is for v8...




2016-02-13 12:37 GMT-05:00 Sylvain LE GAL <sylvain.legal@grap.coop>:
Hi Luis,

I had this kind of issue. For V9 PoS inheritance, you could take a look on OCA module :
This module for exemple, works correctly and is quite complete : (change UI / add extra feature / load extra data) :

OCA / pos / V9 : pos_customer_required : https://github.com/OCA/pos/pull/74

Kind regards.

BTW, review welcome.


Sylvain LE GAL
Service informatique
GRAP - Groupement Régional Alimentaire de Proximité

3 Grande rue des Feuillants, 69001 Lyon
Bureau :
(+33) 09.72.32.33.17
Astreinte :
(+33) 06.81.85.61.43

GRAP sur le Web : Site Web | Facebook | Twitter
GRAP - service Informatique sur le Web : Twitter


2016-02-13 14:42 GMT+01:00 Luis Miguel Sarabia <luismiguel.sarabia@gmail.com>:
Thanks a lot Mustafa. I will chek it.

2016-02-13 3:52 GMT-05:00 Mustafa Sarkazi <sarkazimustafa@gmail.com>:
Luis,

Not sure if v9 is totally different, but I have subscribed the training here to learn about pos development.

Thanks.

--

Best Regards,

Mustafa Sarkazi
Technology Consultant

On Fri, Feb 12, 2016 at 9:27 PM, Luis Miguel Sarabia <luismiguel.sarabia@gmail.com> wrote:
Hi All,


I am trying to inherit ClientListScreenWidget in the screens.js of the point of sale in order to replace the function save_client_details.

In order to make the test easy I have only change the part marked in yellow. 

 this.gui.show_popup('error',_t('XYZ'));

The rest is a copy of the original function.

While adding this my custom module does not load. I get the following error message.

Imagen integrada 1

This is the code of mymodule.js. 

odoo.define('point_of_sale_extension', function (require) {
"use strict";
var modscreen = require('point_of_sale.screens');

modscreen.ClientListScreenWidget.include({

save_client_details: function(partner) {
   var self = this;
   
   var fields = {};
   this.$('.client-details-contents .detail').each(function(idx,el){
       fields[el.name] = el.value;
   });
   if (!fields.name) {
       this.gui.show_popup('error',_t('XYZ'));
       return;
   }
   
   if (this.uploaded_picture) {
       fields.image = this.uploaded_picture;
   }
   fields.id           = partner.id || false;
   fields.country_id   = fields.country_id || false;
   fields.barcode      = fields.barcode || '';
   new Model('res.partner').call('create_from_ui',[fields]).then(function(partner_id){
       self.saved_client_details(partner_id);
   },function(err,event){
       event.preventDefault();
       self.gui.show_popup('error',{
           'title': _t('Error: Could not Save Changes'),
           'body': _t('Your Internet connection is probably down.'),
       });
   });
},
});

});


Please help.


--
Luis Miguel Sarabia

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Luis Miguel Sarabia

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Luis Miguel Sarabia

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe