Debian Codegraph @

addons/l10n_hr_edi/models/account_journal.py

raw
1 from odoo import api, fields, models
2
3
4 class AccountJournal(models.Model):
5 _inherit = 'account.journal'
6
7 l10n_hr_business_premises_label = fields.Char(
8 string="Business premises label",
9 default='1',
10 required=True,
11 size=20,
12 help="Must contain at least one character and a maximum of 20 numeric (0-9) and/or alphabetic (a-z, A-Z) characters.",
13 )
14 l10n_hr_issuing_device_label = fields.Char(
15 string="Issuing device label",
16 default='1',
17 required=True,
18 help="Must contain only numeric characters",
19 )
20 l10n_hr_business_premises_label_refund = fields.Char(
21 string="Business premises label (refund approval)",
22 default='1',
23 required=True,
24 size=20,
25 help="Must contain at least one character and a maximum of 20 numeric (0-9) and/or alphabetic (a-z, A-Z) characters.",
26 )
27 l10n_hr_issuing_device_label_refund = fields.Char(
28 string="Issuing device label (refund approval)",
29 default='2',
30 required=True,
31 help="Must contain only numeric characters",
32 )
33 # MER-specific fields
34 l10n_hr_mer_connection_state = fields.Selection(related='company_id.l10n_hr_mer_connection_state')
35 l10n_hr_is_mer_journal = fields.Boolean(string='Journal used for eRacun via MojEracun', compute='_compute_l10n_hr_is_mer_journal')
36
37 @api.depends('company_id.l10n_hr_mer_purchase_journal_id')
38 def _compute_l10n_hr_is_mer_journal(self):
39 for journal in self:
40 journal.l10n_hr_is_mer_journal = journal.company_id.l10n_hr_mer_purchase_journal_id == journal
41
42 def l10n_hr_mer_get_new_documents(self):
43 self.company_id._l10n_hr_mer_get_new_documents(undelivered_only=True)
44
45 def l10n_hr_mer_get_new_documents_all(self):
46 self.company_id._l10n_hr_mer_get_new_documents(undelivered_only=False)
47
48 def l10n_hr_mer_get_message_status(self):
49 self.company_id._l10n_hr_mer_fetch_document_status_company()