Odoo Help

Welcome!

This community 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.

0

Odoo 8 pos_loyalty module raised errors

By
Odoo
on 1/30/15, 12:10 AM 1,310 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

 

V 7 or 8 ?

aci aisha
on 1/30/15, 12:31 AM

v8

Odoo
on 1/30/15, 12:33 AM

Is pos_loyality is a module for V8?

aci aisha
on 1/30/15, 12:35 AM

yes ..its available in V8 .

Odoo
on 1/30/15, 12:55 AM

Hmm

aci aisha
on 1/30/15, 1:12 AM

Hm? means

Odoo
on 1/30/15, 1:38 AM

Onnulya

aci aisha
on 1/30/15, 1:54 AM

there is any version for ODOO8

isio-odoo
on 2/24/16, 8:52 AM
1

Yenthe

--Yenthe--
6706
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 1/30/15, 4:55 AM

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 ;) )

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

Odoo
on 1/30/15, 4:58 AM

where I can Change this code

Odoo
on 1/30/15, 4:58 AM

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 ;) )

Yenthe
on 1/30/15, 5:02 AM

Thanks...Yenthe I upvoted your answer

Odoo
on 1/30/15, 5:20 AM

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

Yenthe
on 1/30/15, 5:22 AM

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

Odoo
on 1/30/15, 5:38 AM

Hi I added loyalty_points field in res.partner

Odoo
on 1/30/15, 5:41 AM

Can u check my edited code Yenthe...

Odoo
on 1/30/15, 5:42 AM

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?

Yenthe
on 1/30/15, 5:50 AM

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'

Odoo
on 1/30/15, 6:00 AM

same Error...

Odoo
on 1/30/15, 6:01 AM

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.

Yenthe
on 1/30/15, 6:09 AM

will send u a mail can u please check?

Odoo
on 1/30/15, 6:16 AM

Hi Yenthe..Can you give one solution..

Odoo
on 2/2/15, 12:38 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/30/15, 12:10 AM
Seen: 1310 times
Last updated: 3/16/15, 8:10 AM