Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

How to add a reduction amount to the amount total in POS order

Subscribe

Get notified when there's activity on this post

This question has been flagged
ordertotalamountcoupon
5435 Views
Avatar
Matthieu

Hello,

I'm currently trying to add my attribute "coupon_nb" (the amount of reduction given to a customer) to the amount total in pos.order.

My code is here :

class loyalty_reward(osv.osv):

_name = 'loyalty.reward'

_columns = {

'name': fields.char('Name', size=32, select=1, required=True, help='An internal identification for this loyalty reward'),

'loyalty_program_id': fields.many2one('loyalty.program', 'Loyalty Program', help='The Loyalty Program this reward belongs to'),

'minimum_points': fields.float('Minimum Points', help='The minimum amount of points the customer must have to qualify for this reward'),

'type': fields.selection((('gift','Gift'),('discount','Discount'),('resale','Resale')), 'Type', required=True, help='The type of the reward'),

'gift_product_id': fields.many2one('product.product','Gift Product', help='The product given as a reward'),

'point_cost': fields.float('Point Cost', help='The cost of the reward'),

'discount_product_id': fields.many2one('product.product','Discount Product', help='The product used to apply discounts'),

'discount': fields.float('Discount',help='The discount percentage'),

'point_product_id': fields.many2one('product.product', 'Point Product', help='The product that represents a point that is sold by the customer'),

}

def _check_gift_product(self, cr, uid, ids, context=None):

for reward in self.browse(cr, uid, ids, context=context):

if reward.type == 'gift':

return bool(reward.gift_product_id)

else:

return True

def _check_discount_product(self, cr, uid, ids, context=None):

for reward in self.browse(cr, uid, ids, context=context):

if reward.type == 'discount':

return bool(reward.discount_product_id)

else:

return True

def _check_point_product(self, cr, uid, ids, context=None):

for reward in self.browse(cr, uid, ids, context=context):

if reward.type == 'resale':

return bool(reward.point_product_id)

else:

return True

_constraints = [

(_check_gift_product, "The gift product field is mandatory for gift rewards", ["type","gift_product_id"]),

(_check_discount_product, "The discount product field is mandatory for discount rewards", ["type","discount_product_id"]),

(_check_point_product, "The point product field is mandatory for point resale rewards", ["type","discount_product_id"]),

]

<record model="ir.ui.view" id="view_pos_pos_form">

<field name="name">pos.order.inherit</field>

<field name="model">pos.order</field>

<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>

<field name="arch" type="xml">

<xpath expr="//page[@name='extra']" position="inside">

<group name="loyalty" string="Loyalty Programs">

<field name="loyalty_points" />

<field name="coupon_nb" />

</group>

</xpath>

</field>

</record>

 Here I have loyalty_points and coupon_nb that are visible.

But I want coupon_nb to be used to calculate the amount total.

Here you can see the result :

http://i.imgur.com/yGbwoSN.png

But as you can see here,  the amount total doesn't change at all :

http://i.imgur.com/NMcc8TE.png


Please, help me.

0
Avatar
Discard
Matthieu
Author

I failed, the right python code is this : class pos_order(osv.osv): _inherit = 'pos.order' _columns = { 'loyalty_points': fields.float('Loyalty Points', help='The amount of Loyalty points the customer won or lost with this order'), 'coupon_nb': fields.float('Coupon Reduction', help='Coupon amount reduction'), } def _order_fields(self, cr, uid, ui_order, context=None): fields = super(pos_order,self)._order_fields(cr,uid,ui_order,context) fields['loyalty_points'] = ui_order.get('loyalty_points',0) fields['coupon_nb'] = ui_order.get('coupon_nb',0) return fields def _amount_all(self, cr, uid, ids, field_name, arg, context=None): res = super(sale_order, self)._amount_all(cr, uid, ids, field_name, arg, context) for order in self.browse(cr, uid, ids, context=context): res[order.id]['amount_total'] += order.amount_total + order.coupon_nb return res 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']['coupon_nb'] != 0: orderT = self.pool.get('pos.order').browse(cr, uid, ids, context=context) orderT.write({'coupon_nb': order['data']['coupon_nb']}) 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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How to modify amount_total from pos_order
order total amount
Avatar
Avatar
Avatar
4
मई 16
5581
How to edit Total value from order form Solved
order total
Avatar
Avatar
Avatar
15
मई 16
8007
Discount for the amount of the order?
discount order amount
Avatar
Avatar
2
अप्रैल 23
5350
How to get the field values from another module?
total amount saleorder
Avatar
Avatar
2
मार्च 20
13430
PO does not show received quantity
purchase order quantity total received
Avatar
Avatar
2
सित॰ 22
5338
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now