I have 'points' field in res.partner. I have 'total_amount' field in sale.order.
I want to calculate points from the amount sold. Like:
this_customer.points+=total_amount/10
This should happen every time a sale is made. How to do this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have 'points' field in res.partner. I have 'total_amount' field in sale.order.
I want to calculate points from the amount sold. Like:
this_customer.points+=total_amount/10
This should happen every time a sale is made. How to do this?
def _total_amount(self, cr, uid, ids, field_name, arg, context=None):
res = {}
partner_obj = self.pool.get('res.partner')
for value in self.browse(cr,uid,ids):
amount+ = value.total_amount/10
return res
for line in partner_obj.browse(cr,uid,value.partner_id.id):
partner_obj.write(cr,uid,[value.partner_id.id],{'points':amount})
return res
'amount_sold' : fields.function(_total_amount, method=True, string='Amount Sold', type='float',),
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
How to find the field type?
Solved
|
1
जून 25
|
5892 | ||
|
3
जुल॰ 20
|
12709 | |||
|
4
अक्तू॰ 24
|
5978 | |||
|
0
नव॰ 16
|
5169 | |||
|
1
अक्तू॰ 25
|
1827 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.