Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Test HTTP

Entity: test_http.stargate

Compute Method: _compute_sgc_designation

View 20.0
Inputs Method Outputs
  • galaxy_id
  • galaxy_id.name
  • id
  • address
+ """ Forge a sgc designation that looks like a real one. """
+ for gate in self:
+             if gate.galaxy_id.name not in ('Milky Way', 'Pegasus'):
+                 gate.sgc_designation = False
+                 continue
+ 
+             region_part = (
+                 PEGASUS_REGIONS[gate.id % len(PEGASUS_REGIONS)]
+                 if gate.galaxy_id.name == 'Pegasus'
+                 else MILKY_WAY_REGIONS[gate.id % len(MILKY_WAY_REGIONS)]
+             )
+             local_part = str(int.from_bytes(gate.address.encode(), 'big'))[:3]
+             gate.sgc_designation = f'{region_part}-{local_part}'
  • sgc_designation

Back to entity