daily pastebin goal
31%
SHARE
TWEET

test

a guest Mar 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @api.model
  2.     def get_freight_matrix_supplier_ids(self):
  3.         freight_matrix_ids = supplier_ids = []
  4.  
  5.         active_model = self.env.context.get('active_model')
  6.         active_ids = self.env.context.get('active_ids', [])
  7.  
  8.         if active_model == 'jiti.freight.matrix':
  9.             freight_matrix_ids = self.env['jiti.freight.matrix'].browse(active_ids)
  10.  
  11.         else:
  12.             supplier_ids = self.env['res.partner'].browse(active_ids)
  13.             for supplier_id in supplier_ids:
  14.                 if not supplier_id.supplier:
  15.                     raise ValidationError(_('The carrier \'{}\' should be a supplier.').format(supplier_id.name))
  16.                 if not supplier_id.provides_landed_cost:
  17.                     raise ValidationError(
  18.                         _('The carrier \'{}\' should be defined as provides landed cost.'.format(supplier_id.name)))
  19.                 freight_matrix_ids = self.env['jiti.freight.matrix'].search([('carrier_id', '=', supplier_id.id)])
  20.         return freight_matrix_ids, supplier_ids
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top