Portal users don't have write/create permissions on sale.order by default. This causes errors when trying to create orders during checkout or draft save. Changes: - Add _get_salesperson_for_order() helper to retrieve partner's salesperson - Use sudo() for all sale.order create() operations - Automatically assign user_id (salesperson) when creating orders - Use sudo() for order updates and line modifications - Add fallback to commercial_partner_id.user_id for salesperson This ensures orders are created with proper permissions while maintaining traceability through the assigned salesperson. Test coverage: - Add test_portal_sale_order_creation.py with 3 tests - Test portal user creates sale.order - Test salesperson fallback logic - Test portal user updates order lines
14 lines
493 B
Python
14 lines
493 B
Python
# Copyright 2025 Criptomart
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
|
|
|
from . import test_group_order
|
|
from . import test_res_partner
|
|
from . import test_product_extension
|
|
from . import test_eskaera_shop
|
|
from . import test_templates_rendering
|
|
from . import test_record_rules
|
|
from . import test_multi_company
|
|
from . import test_save_order_endpoints
|
|
from . import test_date_calculations
|
|
from . import test_pricing_with_pricelist
|
|
from . import test_portal_sale_order_creation
|