feat(invoicing): managers (+QM+Owner) can create customer invoices
Grant Odoo Billing (account.group_account_invoice) to group_fp_manager via implied_ids; Quality Manager + Owner inherit it. Billing only (not Accountant); the SO-origin workflow gate in fusion_plating_jobs is unchanged, so managers invoice from the Sale Order's Create Invoice action. Tests assert Manager/Owner get Billing and Shop Manager does not. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import test_manager_invoice_permission
|
||||
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
"""Manager (+ QM + Owner) imply Odoo Billing so they can invoice.
|
||||
|
||||
Spec: docs/superpowers/specs/2026-05-29-manager-invoice-permission-design.md
|
||||
"""
|
||||
from odoo.tests.common import TransactionCase, tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install', 'fp_invoice_perm')
|
||||
class TestManagerInvoicePermission(TransactionCase):
|
||||
|
||||
def _user_with(self, group_xmlid):
|
||||
return self.env['res.users'].create({
|
||||
'name': 'PermUser',
|
||||
'login': 'perm_%s' % group_xmlid.split('.')[-1],
|
||||
'group_ids': [(6, 0, [self.env.ref(group_xmlid).id])],
|
||||
})
|
||||
|
||||
def test_manager_has_billing_group(self):
|
||||
manager = self._user_with('fusion_plating.group_fp_manager')
|
||||
self.assertTrue(
|
||||
manager.has_group('account.group_account_invoice'),
|
||||
"Manager should imply Odoo Billing (account.group_account_invoice)",
|
||||
)
|
||||
|
||||
def test_owner_inherits_billing(self):
|
||||
owner = self._user_with('fusion_plating.group_fp_owner')
|
||||
self.assertTrue(owner.has_group('account.group_account_invoice'))
|
||||
|
||||
def test_shop_manager_does_not_get_billing(self):
|
||||
# Shop Manager is BELOW Manager — must NOT inherit Billing
|
||||
# ("managers and ABOVE" scope).
|
||||
shop = self._user_with('fusion_plating.group_fp_shop_manager_v2')
|
||||
self.assertFalse(shop.has_group('account.group_account_invoice'))
|
||||
Reference in New Issue
Block a user