Skip to content

Commit 02f3bd7

Browse files
committed
[IMP] l10n_it_vat_statement_split_payment: black, isort, prettier
1 parent ac27cd5 commit 02f3bd7

9 files changed

Lines changed: 317 additions & 234 deletions

File tree

l10n_it_vat_statement_split_payment/__manifest__.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
55

66
{
7-
'name': "ITA - Liquidazione IVA + Scissione dei pagamenti",
8-
'summary': "Migliora la liquidazione dell'IVA tenendo in"
9-
" considerazione la scissione dei pagamenti",
10-
'version': '12.0.1.0.2',
11-
'development_status': "Beta",
12-
'category': "Accounting & Finance",
13-
'website': 'https://github.com/OCA/l10n-italy',
14-
'author': "Openforce Srls Unipersonale, Odoo Community Association (OCA)",
15-
'license': 'AGPL-3',
16-
'application': False,
17-
'installable': True,
18-
'auto_install': True,
19-
'depends': [
20-
'account_vat_period_end_statement',
21-
'l10n_it_split_payment'
22-
],
23-
'data': [
24-
'views/account_config_view.xml'
25-
]
7+
"name": "ITA - Liquidazione IVA + Scissione dei pagamenti",
8+
"summary": "Migliora la liquidazione dell'IVA tenendo in"
9+
" considerazione la scissione dei pagamenti",
10+
"version": "12.0.1.0.2",
11+
"development_status": "Beta",
12+
"category": "Accounting & Finance",
13+
"website": "https://github.com/OCA/l10n-italy",
14+
"author": "Openforce Srls Unipersonale, Odoo Community Association (OCA)",
15+
"license": "AGPL-3",
16+
"application": False,
17+
"installable": True,
18+
"auto_install": True,
19+
"depends": ["account_vat_period_end_statement", "l10n_it_split_payment"],
20+
"data": ["views/account_config_view.xml"],
2621
}

l10n_it_vat_statement_split_payment/models/account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class AccountMoveLine(models.Model):
10-
_inherit = 'account.move.line'
10+
_inherit = "account.move.line"
1111

1212
@api.multi
1313
def group_by_account_and_tax(self):

l10n_it_vat_statement_split_payment/models/account_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88

99
class ResConfigSettings(models.TransientModel):
10-
_inherit = 'res.config.settings'
10+
_inherit = "res.config.settings"
1111

1212
sp_description = fields.Char(
13-
related='company_id.sp_description',
13+
related="company_id.sp_description",
1414
string="Description for period end statements",
15-
readonly=False
15+
readonly=False,
1616
)

l10n_it_vat_statement_split_payment/models/res_company.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88

99
class ResCompany(models.Model):
10-
_inherit = 'res.company'
10+
_inherit = "res.company"
1111

12-
sp_description = fields.Char(
13-
string="Description for period end statements"
14-
)
12+
sp_description = fields.Char(string="Description for period end statements")

l10n_it_vat_statement_split_payment/models/statement.py

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,38 @@
77

88

99
class AccountVatPeriodEndStatement(models.Model):
10-
_inherit = 'account.vat.period.end.statement'
10+
_inherit = "account.vat.period.end.statement"
1111

1212
@api.multi
1313
def compute_amounts(self):
1414

15-
AccountMoveLine = self.env['account.move.line']
16-
StatementGenericAccountLine = \
17-
self.env['statement.generic.account.line']
15+
AccountMoveLine = self.env["account.move.line"]
16+
StatementGenericAccountLine = self.env["statement.generic.account.line"]
1817

1918
res = super().compute_amounts()
2019

21-
if self.env.user.company_id and \
22-
self.env.user.company_id.sp_description:
20+
if self.env.user.company_id and self.env.user.company_id.sp_description:
2321
basename = self.env.user.company_id.sp_description
2422

2523
else:
2624
basename = _("Write-off tax amount on tax")
2725

2826
for statement in self:
29-
statement.generic_vat_account_line_ids = \
30-
statement.generic_vat_account_line_ids \
31-
.filtered(lambda x: not x.is_split_payment)
27+
statement.generic_vat_account_line_ids = (
28+
statement.generic_vat_account_line_ids.filtered(
29+
lambda x: not x.is_split_payment
30+
)
31+
)
3232

3333
for date_range in statement.date_range_ids:
34-
acc_move_lines = AccountMoveLine.search([
35-
('invoice_id.amount_sp', '!=', 0.0),
36-
('tax_line_id', '!=', False),
37-
('date', '>=', date_range.date_start),
38-
('date', '<=', date_range.date_end)
39-
])
34+
acc_move_lines = AccountMoveLine.search(
35+
[
36+
("invoice_id.amount_sp", "!=", 0.0),
37+
("tax_line_id", "!=", False),
38+
("date", ">=", date_range.date_start),
39+
("date", "<=", date_range.date_end),
40+
]
41+
)
4042

4143
if not acc_move_lines:
4244
continue
@@ -45,8 +47,7 @@ def compute_amounts(self):
4547
date_start_str = date_range.date_start
4648
date_end_str = date_range.date_end
4749

48-
date_string = _("from {} to {}") \
49-
.format(date_start_str, date_end_str)
50+
date_string = _("from {} to {}").format(date_start_str, date_end_str)
5051

5152
for group_key in grouped_lines:
5253
amount = 0.0
@@ -55,23 +56,25 @@ def compute_amounts(self):
5556
amount += line.credit - line.debit
5657

5758
name = "{} {} - {}".format(
58-
basename, group_key[1].description, date_string)
59+
basename, group_key[1].description, date_string
60+
)
5961

60-
account = statement.company_id.sp_account_id\
61-
or group_key[0]
62+
account = statement.company_id.sp_account_id or group_key[0]
6263

63-
StatementGenericAccountLine.create({
64-
'name': name,
65-
'amount': amount,
66-
'account_id': account.id,
67-
'statement_id': statement.id,
68-
'is_split_payment': True
69-
})
64+
StatementGenericAccountLine.create(
65+
{
66+
"name": name,
67+
"amount": amount,
68+
"account_id": account.id,
69+
"statement_id": statement.id,
70+
"is_split_payment": True,
71+
}
72+
)
7073

7174
return res
7275

7376

7477
class StatementGenericAccountLine(models.Model):
75-
_inherit = 'statement.generic.account.line'
78+
_inherit = "statement.generic.account.line"
7679

7780
is_split_payment = fields.Boolean()

0 commit comments

Comments
 (0)