Odoo Help


1 Answer

Sylvain Michel RATSARAFAHATRA Madagascar

--Sylvain Michel RATSARAFAHATRA--
| 3 2 4
Antananarivo, Madagascar
--Sylvain Michel RATSARAFAHATRA--
Certified Odoo Professional - Odoo/Python Technical Referent

Odoo/Python Developer for more than 5 years, with twenty projects to my credit whether in Madagascar or internationally.

• Development/Maintenance of Odoo modules; 

• Coaching and training of developers; 

• Technical support on projects; 

• Analysis and design of appropriate solutions to customer requests;

Linkedin : https://www.linkedin.com/in/sylvain-michel-ratsarafahatra/

Facebook : https://www.facebook.com/r.sylvainmichel

Sylvain Michel RATSARAFAHATRA Madagascar
12/2/19, 10:54 PM


Change the code like this :

class PurchaseOrder(models.Model):
_inherit = "purchase.order"

x_grand_total = fields.Float(compute='_compute_x_grand_total', string='Grand Total')

def _compute_x_grand_total(self):
self.x_grand_total = sum(line.x_line_total for line in self.order_line)

Best regards!

1 Comment
Haris Masqati Pakistan
12/4/19, 10:22 AM

i tried your code but this error has been occurred

self.x_grand_total = sum(line.x_line_total for line in self.order_line)

AttributeError: 'purchase.order.line' object has no attribute 'x_line_total'

Ask a Question
Keep Informed
1 follower(s)
About This Community

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

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now