Skip to Content
Menu
This question has been flagged
1 Reply
2347 Views

i have try to add custom filed in sale order line

Here is my .PY

class CustomSaleOrderLine(models.Model):

    _inherit = 'sale.order.line'

   

 _totalweight = fields.Float(string="Total Weight",compute='_totalweight')

 @api.multi

    def _totalweight(self):

  self._totalweight = 15.00


What i am trying to achieve is that i take the value order of product qty and multiply it by 5

I am doing it right way ? but how ever i expected to see this 

  File "/odoo/odoo-server/addons/sale_order_line_custom/models/models.py", line 8
    _totalweight = fields.Float(string="Total Weight",compute='_totalweight')
    ^
IndentationError: unexpected indent

But i think in my code i dont think there is anything wrong with indentation 

Please help 


Avatar
Discard
Best Answer

Hai Vootipong Limpanitivat,
     Please replace your code with mine, 


class CustomSaleOrderLine(models.Model): _inherit = 'sale.order.line' @api.multi def totalweight(self): print "addddddddddddddddddddd" self._totalweight = 15.00 _totalweight = fields.Float(string="Total Weight", compute='totalweight')

Thank you

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 24
122
3
Aug 24
527
0
Feb 24
263
0
Feb 24
157
1
Jan 24
1324