Debian Codegraph @

addons/l10n_hr_edi/tests/test_hr_edi_common.py

raw
1 from odoo import Command
2 from odoo.addons.account.tests.common import AccountTestInvoicingCommon
3
4
5 class TestL10nHrEdiCommon(AccountTestInvoicingCommon):
6
7 @classmethod
8 def setUpClass(cls):
9 super().setUpClass()
10 cls.env.company.tax_calculation_rounding_method = 'round_globally'
11 cls.partner_a.invoice_edi_format = 'ubl_hr'
12 cls.product_a.product_tmpl_id.l10n_hr_kpd_category_id = cls.env['l10n_hr.kpd.category'].search([('name', '=', '01.11.11')])
13 cls.env.user.partner_id.l10n_hr_personal_oib = '01234567896'
14
15 cls.pay_term_epd_mixed = cls.env['account.payment.term'].create({
16 'name': "2/7 Net 30",
17 'note': "Payment terms: 30 Days, 2% Early Payment Discount under 7 days",
18 'early_discount': True,
19 'discount_percentage': 2,
20 'discount_days': 7,
21 'early_pay_discount_computation': 'mixed',
22 'line_ids': [Command.create({'value': 'percent', 'value_amount': 100.0, 'nb_days': 30})],
23 })
24
25 @classmethod
26 def _create_company(cls, **create_values):
27 # EXTENDS 'account'
28 create_values['currency_id'] = cls.env.ref('base.EUR').id
29 create_values['country_id'] = cls.env.ref('base.hr').id
30 return super()._create_company(**create_values)
31
32 def setup_partner_as_hr(self, partner):
33 partner.write({
34 'street': "Croatian Street 1",
35 'zip': "1234",
36 'city': "Croatian City",
37 'vat': 'HR68139364755',
38 'l10n_hr_personal_oib': '68139364755',
39 'country_id': self.env.ref('base.hr').id,
40 'bank_ids': [Command.create({'acc_number': 'HR10000000000000'})],
41 'email': '[email protected]',
42 'invoice_sending_method': 'mojeracun',
43 })
44
45 def setup_partner_as_hr_alt(self, partner):
46 partner.write({
47 'street': "Croatian Street 2",
48 'zip': "5678",
49 'city': "Other Croatian City",
50 'vat': 'HR08971065561',
51 'l10n_hr_personal_oib': '08971065561',
52 'country_id': self.env.ref('base.hr').id,
53 'bank_ids': [Command.create({'acc_number': 'HR20000000000000'})],
54 'email': '[email protected]',
55 'invoice_sending_method': 'mojeracun',
56 })
57
58 def setup_partner_as_mirror(self, partner):
59 partner.write({
60 'street': "Looking Glass Street 1",
61 'zip': "5252",
62 'city': "Other Croatian City",
63 'vat': 'BE0477472701',
64 'l10n_hr_personal_oib': '00000000000',
65 'country_id': self.env.ref('base.hr').id,
66 'bank_ids': [Command.create({'acc_number': 'HR30000000000000'})],
67 'email': '[email protected]',
68 'invoice_sending_method': 'mojeracun',
69 })