Add multi client template management
This commit is contained in:
@@ -301,6 +301,64 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
with self.assertRaises(UserError):
|
||||
report.validate_remote_weight_report_context(shipment)
|
||||
|
||||
def test_invoice_report_uses_invoice_template_from_configuration(self):
|
||||
'invoice report path is resolved from purchase_trade configuration'
|
||||
report_class = Pool().get('account.invoice', type='report')
|
||||
config_model = Mock()
|
||||
config_model.search.return_value = [
|
||||
Mock(
|
||||
invoice_report_template='invoice_melya.fodt',
|
||||
invoice_cndn_report_template='invoice_ict_final.fodt',
|
||||
invoice_prepayment_report_template='prepayment.fodt',
|
||||
)
|
||||
]
|
||||
|
||||
with patch(
|
||||
'trytond.modules.purchase_trade.invoice.Pool'
|
||||
) as PoolMock:
|
||||
PoolMock.return_value.get.return_value = config_model
|
||||
|
||||
self.assertEqual(
|
||||
report_class._resolve_configured_report_path({
|
||||
'name': 'Invoice',
|
||||
'report': 'account_invoice/invoice.fodt',
|
||||
}),
|
||||
'account_invoice/invoice_melya.fodt')
|
||||
self.assertEqual(
|
||||
report_class._resolve_configured_report_path({
|
||||
'name': 'Prepayment',
|
||||
'report': 'account_invoice/prepayment.fodt',
|
||||
}),
|
||||
'account_invoice/prepayment.fodt')
|
||||
self.assertEqual(
|
||||
report_class._resolve_configured_report_path({
|
||||
'name': 'CN/DN',
|
||||
'report': 'account_invoice/invoice_ict_final.fodt',
|
||||
}),
|
||||
'account_invoice/invoice_ict_final.fodt')
|
||||
|
||||
def test_invoice_report_raises_when_template_is_missing(self):
|
||||
'invoice report must fail clearly when no template is configured'
|
||||
report_class = Pool().get('account.invoice', type='report')
|
||||
config_model = Mock()
|
||||
config_model.search.return_value = [
|
||||
Mock(
|
||||
invoice_report_template='',
|
||||
invoice_cndn_report_template='',
|
||||
invoice_prepayment_report_template='',
|
||||
)
|
||||
]
|
||||
|
||||
with patch(
|
||||
'trytond.modules.purchase_trade.invoice.Pool'
|
||||
) as PoolMock:
|
||||
PoolMock.return_value.get.return_value = config_model
|
||||
with self.assertRaises(UserError):
|
||||
report_class._resolve_configured_report_path({
|
||||
'name': 'Invoice',
|
||||
'report': 'account_invoice/invoice.fodt',
|
||||
})
|
||||
|
||||
def test_sale_report_multi_line_helpers_aggregate_all_lines(self):
|
||||
'sale report helpers aggregate quantity, price lines and shipment periods'
|
||||
Sale = Pool().get('sale.sale')
|
||||
|
||||
Reference in New Issue
Block a user