fix: trigger client reload, specify view type, and update account company search criteria
This commit is contained in:
parent
98486e284e
commit
9900d297fc
13
README.md
13
README.md
@ -47,6 +47,19 @@ A custom Odoo 19 module introducing comprehensive security permissions, double-a
|
||||
|
||||
---
|
||||
|
||||
## 🩹 Recent Fixes & Compatibility Updates
|
||||
|
||||
### 1. Odoo 19 Multi-Company Sharing Schema Compatibility
|
||||
- Swapped deprecated `company_id` filters with the new standard Many2many `company_ids` domain mapping when querying `account.account` instances. This prevents `ValueError: Invalid field account.account.company_id` backend crashes when creating loyalty discount products.
|
||||
|
||||
### 2. Client Action Preprocessing Safety
|
||||
- Added explicit view layout parameters (`'views': [[False, 'form']]`) to the wizard action dictionaries. This prevents frontend JS crashes (`TypeError: Cannot read properties of undefined (reading 'map')`) when Odoo's web client pre-processes nested actions outside standard loaded actions.
|
||||
|
||||
### 3. Real-Time State Synchronization
|
||||
- Chained a soft-reload client action (`'next': {'type': 'ir.actions.client', 'tag': 'reload'}`) directly within the approval notification return payload. This ensures that the voucher request's state immediately updates to **Approved** in the UI and lists the newly generated voucher cards without requiring a manual page refresh.
|
||||
|
||||
---
|
||||
|
||||
## 📂 Technical Layout & Structure
|
||||
|
||||
```text
|
||||
|
||||
@ -26,7 +26,7 @@ class LoyaltyReward(models.Model):
|
||||
company = reward.company_id or self.env.company
|
||||
account = self.env['account.account'].sudo().search([
|
||||
('code', '=', '412201'),
|
||||
('company_id', '=', company.id)
|
||||
('company_ids', '=', company.id)
|
||||
], limit=1)
|
||||
if account:
|
||||
vals['property_account_income_id'] = account.id
|
||||
|
||||
@ -149,6 +149,7 @@ class LoyaltyVoucherGenerationRequest(models.Model):
|
||||
'message': _('Vouchers generated successfully.'),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.client', 'tag': 'reload'},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ class LoyaltyGenerateWizard(models.TransientModel):
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'loyalty.voucher.generation.request',
|
||||
'view_mode': 'form',
|
||||
'views': [[False, 'form']],
|
||||
'res_id': requests[0].id,
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user