Hello,
I've got a little problem. I'm currently creating a custom module on Odoo 9 and I want to get an attribute defined in _columns in an inherit of pos_order in another class inherited : account_invoice.
For this purpose, I declared a variable order as it :
order = self.env['pos.order'].browse(self.reference)
The value I wanna get is the attribute "coupon_nb" from order but the things I tried ("order['coupon_nb'], order[0]['coupon_nb'], order.coupon_nb, order.get('coupon_nb'), ...).
But nothing worked.
Please, help me !
Thank you in advance for your help.
what order gives you ? and what the result of order.coupon_nb ?
When i see the log as a result of "_logger.info("ORDER = %r", order)", we can see "ORDER = pos.order(u'Main/0017',)" and when I do the same thing with "_logger.info("ORDER COUPON = %r", order.coupon_nb)", I got this error : INFO db4 openerp.sql_db: bad query: SELECT "pos_order"."fiscal_position_id" as "fiscal_position_id","pos_order"."id" as "id","pos_order"."state" as "state","pos_order"."create_uid" as "create_uid","pos_order"."pricelist_id" as "pricelist_id","pos_order"."create_date" as "create_date","pos_order"."invoice_id" as "invoice_id","pos_order"."coupon_nb" as "coupon_nb","pos_order"."write_uid" as "write_uid","pos_order"."write_date" as "write_date","pos_order"."account_move" as "account_move","pos_order"."sale_journal" as "sale_journal","pos_order"."loyalty_points" as "loyalty_points","pos_order"."company_id" as "company_id","pos_order"."location_id" as "location_id","pos_order"."session_id" as "session_id","pos_order"."nb_print" as "nb_print","pos_order"."name" as "name","pos_order"."user_id" as "user_id","pos_order"."partner_id" as "partner_id","pos_order"."note" as "note","pos_order"."pos_reference" as "pos_reference","pos_order"."picking_id" as "picking_id","pos_order"."date_order" as "date_order","pos_order"."sequence_number" as "sequence_number" FROM "pos_order" WHERE "pos_order".id IN ('Main/0017') ORDER BY "pos_order"."id" DESC
(the end of the error :) DataError: invalid input syntax for integer: "Main/0017" LINE 2: WHERE "pos_order".id IN ('Main/0017'...