Skip to content

Comments

Oduist proprietary license#71

Open
litnimax wants to merge 41 commits into18.0from
18.0-opl
Open

Oduist proprietary license#71
litnimax wants to merge 41 commits into18.0from
18.0-opl

Conversation

@litnimax
Copy link
Member

No description provided.

litnimax and others added 29 commits December 15, 2025 14:49
…ove code formatting

- Bump version from 1.0.12 to 2.0.1
- Remove obsolete migration scripts (versions 0.6-1.0.6)
- Update manifest.py to use double quotes for consistency
- Refactor license and settings models for better maintainability
- Add AGENTS.md development guidelines
- Simplify settings view configuration
- Minor Finnish translation fixes
Use get_license_status() from license.py to eliminate code duplication.
This ensures a single source of truth for license logic and automatically
handles all license statuses (licensed, trial_active, trial_expired, demo).

- Remove duplicate license validation logic
- Remove unused imports (datetime, timedelta)
- Remove unused TRIAL_DAYS constant
- Add demo license status handling
- Extend get_license_status() to return price and license_type from server
- Add computed fields oduist_module_price and oduist_module_license_type to ir.module.module
- Display price and license type in the license management UI (optional columns)
- Initialize new fields for all license statuses (licensed, trial, demo)
- Change oduist_module_price from computed to regular field
- Remove price computation from _compute_oduist_license_status()
- Set price in update_license_status() with priority: purchased_modules.price > modules.price
- Price is now stored in DB and updated during license sync
- Remove oduist_module_price field from ir_module_module
- Remove oduist_module_description field from ir_module_module
- Remove price retrieval logic from get_license_status()
- Remove price and description update logic from update_license_status()
- Remove Price and Description columns from license view UI

These fields are no longer provided by the license server.
This commit refactors the originate_call method to follow proper MVC
separation of concerns by moving it from the Settings model to the Call model.

CHANGES:

1. Move originate_call() method from connect/models/settings.py to
   connect/models/call.py
   - Add import of MAX_EXTEN_LEN and strip_number from respective modules
   - Update redial() method to call local originate_call()

2. Remove strip_number duplication
   - Remove strip_number() from connect/models/settings.py (was copied to
     avoid circular imports)
   - Import strip_number from connect/models/res_partner.py everywhere:
     * connect/models/call.py
     * connect/models/whatsapp_sender.py
     * connect_website/models/settings.py
   - Remove unused strip_number import from connect/models/user.py

3. Consolidate MAX_EXTEN_LEN definition
   - Keep single definition in connect/models/settings.py
   - Import in connect/models/call.py instead of defining locally
   - External modules (crm_lead, ticket) continue importing from settings

4. Update phone_field.js widget
   - Change ORM calls from 'connect.settings' to 'connect.call' model
   - Both regular and WhatsApp call buttons now target correct model

5. Move connect_website override to dedicated model
   - Create new connect_website/models/call.py with Call model inheriting
     from connect.call
   - Move originate_call() override from Settings to Call for website-specific
     logic (8-digit number handling)
   - Simplify connect_website/models/settings.py by removing method override
   - Add call.py import to connect_website/models/__init__.py

BENEFITS:
- Better architectural separation: call origination logic in Call model
- No code duplication of strip_number and MAX_EXTEN_LEN
- Clearer inheritance hierarchy for extensions
- Settings model remains focused on configuration only

FILES MODIFIED:
- connect/models/call.py (+106, -0)
- connect/models/settings.py (-116)
- connect/models/user.py (-2 import)
- connect/models/whatsapp_sender.py (+1 import, -1 method call)
- connect/static/src/widgets/phone_field/phone_field.js (+2 model names)
- connect_website/models/__init__.py (+1 import)
- connect_website/models/settings.py (-61 method)
- connect_website/models/call.py (new file, +61 lines)
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5948f44896

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 18 to 22
# Private key for signing tokens (keep this secure!)
PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCmCFuUGRYdziwb
FNwpG9uxKzvRn1MxwY1lUmFls8Hr9YpEQGt804mPPTql9p7yIyTwtKdiUYtwrDqV
W62kFx4UgyJ+ZhAlGaAVs2pnYz4TDyZ7yjqAXaTaDCE1PrKjxq+raIV31wL8ttv6

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove embedded private license signing key

The license generator embeds the RS256 private key directly in the repository. Anyone with access to this code can mint valid license tokens and bypass licensing (or impersonate your license server), which is a credential leak and undermines the security of the license system. Store the key outside the repo (secret manager/env var) and load it at runtime instead of committing it.

Useful? React with 👍 / 👎.

Comment on lines 126 to 130
"issuer": "oduist.com",
"instance_uid": instance_uid,
"type": license_type,
"expire": expire_timestamp,
"modules": modules,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align token payload with validator expectations

This script emits tokens containing instance_uid, modules, and expire, but the validator in connect/models/license.py only accepts tokens that include instance_hash and purchased_modules (and relies on JWT exp for expiry). As written, tokens produced by this script (and the documented schema) will not validate, so the system will fall back to trial_expired even for paid installs. Either update the generator/schema to match the validator or change the validator to accept the generated fields and enforce expiration consistently.

Useful? React with 👍 / 👎.

litnimax and others added 12 commits January 21, 2026 20:07
- Remove set_defaults function call from license.xml
- Move API URL initialization to _get_instance_data (lazy init)
- Set webhook user password on first api_url access
- Initialization now happens once on first request instead of installation
Move the `strip_number` function from `res_partner.py` to `settings.py` to improve code organization. This function is now available for use across different models.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants