Debian Codegraph @

addons/l10n_latam_check/models/account_chart_template.py

raw
1 from odoo import models, Command, api, _
2 from odoo.addons.account.models.chart_template import template
3
4
5 class AccountChartTemplate(models.AbstractModel):
6 _inherit = 'account.chart.template'
7
8 @api.model
9 def _get_third_party_checks_country_codes(self):
10 """ Return the list of country codes for the countries where third party checks journals should be created
11 when installing the COA"""
12 return ["AR"]
13
14 @template(model='account.journal')
15 def _get_latam_check_account_journal(self, template_code):
16 if self.env.company.country_id.code in self._get_third_party_checks_country_codes():
17 return {
18 "third_party_check": {
19 'name': _('Third Party Checks'),
20 'type': 'cash',
21 'outbound_payment_method_line_ids': [
22 Command.create({
23 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_out_third_party_checks').id,
24 'payment_account_id': 'base_outstanding_payments',
25 }),
26 ],
27 'inbound_payment_method_line_ids': [
28 Command.create({
29 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_new_third_party_checks').id,
30 'payment_account_id': 'base_outstanding_receipts',
31 }),
32 Command.create({
33 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_in_third_party_checks').id,
34 'payment_account_id': 'base_outstanding_receipts',
35 }),
36 ],
37 },
38 "rejected_third_party_check": {
39 'name': _('Rejected Third Party Checks'),
40 'type': 'cash',
41 'outbound_payment_method_line_ids': [
42 Command.create({
43 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_out_third_party_checks').id,
44 'payment_account_id': 'base_outstanding_payments',
45 }),
46 ],
47 'inbound_payment_method_line_ids': [
48 Command.create({
49 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_new_third_party_checks').id,
50 'payment_account_id': 'base_outstanding_receipts',
51 }),
52 Command.create({
53 'payment_method_id': self.env.ref('l10n_latam_check.account_payment_method_in_third_party_checks').id,
54 'payment_account_id': 'base_outstanding_receipts',
55 }),
56 ],
57 },
58 }
59
60 @template(model='account.account')
61 def _get_latam_check_outstanding_account_account(self, template_code):
62 if self.env.company.country_id.code in self._get_third_party_checks_country_codes():
63 return {
64 'base_outstanding_receipts': {
65 'name': _("Outstanding Receipts"),
66 'code': '1.1.1.02.003',
67 'reconcile': True,
68 'account_type': 'asset_current',
69 },
70 'base_outstanding_payments': {
71 'name': _("Outstanding Payments"),
72 'code': '1.1.1.02.004',
73 'reconcile': True,
74 'account_type': 'asset_current',
75 },
76 }