forked from OCA/l10n-italy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Copyright 2015 Davide Corio <[email protected]> | ||
# Copyright 2015-2016 Lorenzo Battistini - Agile Business Group | ||
# Copyright 2015-2018 Lorenzo Battistini - Agile Business Group | ||
# Copyright 2016 Alessio Gerace - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Split Payment', | ||
'version': '11.0.1.0.0', | ||
'version': '11.0.1.1.0', | ||
'category': 'Localization/Italy', | ||
'summary': 'Split Payment', | ||
'author': 'Abstract, Agile Business Group, ' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
|
||
from . import account | ||
from . import config | ||
from . import account_tax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class AccountTax(models.Model): | ||
_inherit = 'account.tax' | ||
is_split_payment = fields.Boolean( | ||
"Is split payment", compute="_compute_is_split_payment") | ||
|
||
@api.multi | ||
def _compute_is_split_payment(self): | ||
for tax in self: | ||
fp_lines = self.env['account.fiscal.position.tax'].search( | ||
[('tax_dest_id', '=', tax.id)]) | ||
tax.is_split_payment = any( | ||
fp_line.position_id.split_payment for fp_line in fp_lines | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Copyright 2015 Davide Corio <[email protected]> | ||
# Copyright 2015-2016 Lorenzo Battistini - Agile Business Group | ||
# Copyright 2015-2018 Lorenzo Battistini - Agile Business Group | ||
# Copyright 2016 Alessio Gerace - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
@@ -15,13 +15,21 @@ def setUp(self): | |
self.term_model = self.env['account.payment.term'] | ||
self.inv_line_model = self.env['account.invoice.line'] | ||
self.fp_model = self.env['account.fiscal.position'] | ||
self.tax22sp = self.tax_model.create({ | ||
'name': '22% SP', | ||
'amount': 22, | ||
}) | ||
self.tax22 = self.tax_model.create({ | ||
'name': '22%', | ||
'amount': 22, | ||
}) | ||
self.sp_fp = self.fp_model.create({ | ||
'name': 'Split payment', | ||
'split_payment': True, | ||
'tax_ids': [(0, 0, { | ||
'tax_src_id': self.tax22.id, | ||
'tax_dest_id': self.tax22sp.id | ||
})] | ||
}) | ||
self.company = self.env.ref('base.main_company') | ||
self.company.sp_account_id = self.env['account.account'].search([ | ||
|
@@ -68,6 +76,7 @@ def setUp(self): | |
limit=1).date_invoice | ||
|
||
def test_invoice(self): | ||
self.assertTrue(self.tax22sp.is_split_payment) | ||
invoice = self.invoice_model.create({ | ||
'date_invoice': self.recent_date, | ||
'partner_id': self.env.ref('base.res_partner_3').id, | ||
|
@@ -80,7 +89,7 @@ def test_invoice(self): | |
'quantity': 1, | ||
'price_unit': 100, | ||
'invoice_line_tax_ids': [(6, 0, { | ||
self.tax22.id | ||
self.tax22sp.id | ||
})] | ||
})] | ||
}) | ||
|
@@ -115,7 +124,7 @@ def test_invoice(self): | |
'quantity': 1, | ||
'price_unit': 100, | ||
'invoice_line_tax_ids': [(6, 0, { | ||
self.tax22.id | ||
self.tax22sp.id | ||
})] | ||
})] | ||
}) | ||
|
@@ -150,7 +159,7 @@ def test_invoice(self): | |
'quantity': 1, | ||
'price_unit': 100, | ||
'invoice_line_tax_ids': [(6, 0, { | ||
self.tax22.id | ||
self.tax22sp.id | ||
})] | ||
})] | ||
}) | ||
|