77
88
99class 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
7477class 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