Hi All,
I was trying to save the tracking number in stock.picking model by updating the field, 'carrier_tracking_ref'. So according to the documentation, it should be a straight forward process. I have tried,
from odoo import api, fields, models, _
from odoo.exceptions import Warning
class StockPicking(models.Model):
_inherit = 'stock.picking'
@api.multi
def button_book_shipment(self):
for rec in self:
# self.book_shipment(rec)
rec.carrier_tracking_ref = 'TRACKING_NUMBER'
# I also tried using write method
pick = self.env['stock.picking'].browse(46)
pick.write({ 'carrier_tracking_ref': 'TRACKING_NUMBER' })
raise Warning(_('Booking shipment DONE'))
But neither of these works and the value does not get updated. I wonder if I have missed anything here or how I can update this field?
If I edit the picking record from the Odoo UI and manually it enter the tracking number, it saves the value properly. How do I do it in code?
Thanks.