This question has been flagged
1 Reply
3330 Views

Hi All,

I tried to install 'pos_loyalty'(https://www.odoo.com/apps/modules/master/pos_loyalty/) module from Master series .But After installation and try to start point of Sale Session,it raises Errors.

If I comment this code from 'pos_loyaly.py' it works .I think error is coming from this function.But the Loyalty feature is not working. I tried in both linux and windows platform.Please assist me how to resolve

def create_from_ui(self, cr, uid, orders, context=None):
        ids = super(pos_order,self).create_from_ui(cr,uid,orders,context=context)
        for order in orders:
            if order['data']['loyalty_points'] != 0 and order['data']['partner_id']:
                partner = self.pool.get('res.partner').browse(cr,uid,order['data']['partner_id'], context=context)
                partner.write({'loyalty_points': partner['loyalty_points'] + order['data']['loyalty_points']})

        return ids

 

This is the error stack=======================================================

Traceback (most recent call last):

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 500, in _handle_exception

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 517, in dispatch

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 283, in _call_function

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\service\model.py", line 113, in wrapper

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 280, in checked_call

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 733, in __call__

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\http.py", line 376, in response_wrap

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\openerp\addons\web\controllers\main.py", line 948, in call_kw

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\openerp\addons\web\controllers\main.py", line 940, in _call_kw

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\.\openerp\api.py", line 237, in wrapper

  File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\openerp\addons\pos_loyalty\loyalty.py", line 135, in create_from_ui

KeyError: 'loyalty_points'

EDITED

===================================

<record model="ir.ui.view" id="view_partner_property_form">
            <field name="name">res.partner.product.property.form.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="point_of_sale.view_partner_property_form"/>
            <field name="arch" type="xml">
                <xpath expr="//page[@string='Accounting']/group" position="after">
                    <group name="loyalty" string="Loyalty Programs">
                        <field name="loyalty_points" />
                         
                    </group>
                </xpath>
            </field>
        </record>

 

How to resolve this issue

 

Avatar
Discard

V 7 or 8 ?

Author

v8

Is pos_loyality is a module for V8?

Author

yes ..its available in V8 .

Author

Hm? means

Onnulya

there is any version for ODOO8

Best Answer

I believe you are talking about this module: https://www.odoo.com/apps/modules/master/pos_loyalty/ am I correct?
This module is built for the version 'Master' and not 'V8'. Which means it isn't supported in your Odoo version, since you're using version 8. The only way for you to get this working is to do an extensive debugging and adding the code they've added in the master to make this module work.

Update: If you want to fix this.. The first thing that I notice is that there is a new field in the model res.partner named 'loyalty_points' (in Master) which is not currently available in Odoo V8 so start from there by adding that. Then see what comes up next :) (P.S: Please upvote/accept if this helped you ;) )

Avatar
Discard
Author

Yes Yenthe Thanks for your replay...You are correct ,module is from master/pos_loyalty/

Author

where I can Change this code

If I where you I'd start in the module pos_loyalty at the file loyalty.py. Compare your loyalty.py file with the master version from github (https://github.com/odoo/odoo/blob/master/addons/pos_loyalty/loyalty.py) The first thing that I notice is that there is a new field in the model res.partner named 'loyalty_points' which is not currently available in Odoo V8 so start from there by adding that. Then see what comes up next :) (P.S: Please upvote/accept if this helped you ;) )

Author

Thanks...Yenthe I upvoted your answer

Thanks Libu! Was the only problem the missing field 'loyalty_points'?

Author

actually I added this 'loyalty_points ' in view xml file res.partner

Author

Hi I added loyalty_points field in res.partner

Author

Can u check my edited code Yenthe...

Alright so you've added the field 'loyalty_points' in the model res.partner and then inherited the point_of_sale.view_partner_property_form.. so what error is it exactly throwing up now?

Author

File "C:\Program Files (x86)\Odoo 8.0-20141114-010209\server\openerp\addons\pos_loyalty\loyalty.py", line 135, in create_from_ui KeyError: 'loyalty_points'

Author

same Error...

Do you have the field 'loyalty_points' both in res.partner and pos.order and do you have a many2one loyalty_id in the model pos.config? I assume you're missing some other code that they've implemented in another module which wasn't there in V8. Which then causes the module to not work & install all its fields etc. Its hard to check what is wrong from here sadly.

Author

will send u a mail can u please check?

Author

Hi Yenthe..Can you give one solution..