Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Create a transit location with company_id in odoo-9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 675
    Comment on it

    To Create a transit location with company_id being the given company_id. This is needed in case of resupply routes between warehouses belonging to the same company, because we don't want to create accounting entries at that time. For this use this code given below in .py file.

    def create_transitlocation(self, cr, uid, company_id, company_name, context=None):
            data_obj = self.pool.get('ir.model.data')
            try:
                parent_loc = data_obj.get_object_reference(cr, uid, 'stock', 'stock_location_locations')[1]
            except:
                parent_loc = False
            location_vals = {
                'name': _('%s: Transit Location') % company_name,
                'usage': 'transit',
                'company_id': company_id,
                'location_id': parent_loc,
            }
            location_id = self.pool.get('stock.location').create(cr, uid, location_vals, context=context)
            self.write(cr, uid, [company_id], {'internal_transit_location_id': location_id}, context=context)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: