portal_share_1.py 449 B

123456789
  1. def default_get(self, fields):
  2. result = super(PortalShare, self).default_get(fields)
  3. result['res_model'] = self._context.get('active_model', False)
  4. result['res_id'] = self._context.get('active_id', False)
  5. if result['res_model'] and result['res_id']:
  6. record = self.env[result['res_model']].browse(result['res_id'])
  7. result['share_link'] = record.get_base_url() + record._get_share_url(redirect=True)
  8. return result