Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0] ADD TD20 doc type #725

Merged
merged 1 commit into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n_it_fatturapa_out/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
'name': 'Italian Localization - Fattura elettronica - Emissione',
'version': '12.0.1.0.0',
'version': '12.0.1.0.1',
'development_status': 'Beta',
'category': 'Localization/Italy',
'summary': 'Emissione fatture elettroniche',
Expand Down
4 changes: 1 addition & 3 deletions l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,7 @@ def setDatiGeneraliDocumento(self, invoice, body):
raise UserError(
_('Invoice does not have a number.'))

TipoDocumento = 'TD01'
if invoice.type == 'out_refund':
TipoDocumento = 'TD04'
TipoDocumento = invoice.fiscal_document_type_id.code
ImportoTotaleDocumento = invoice.amount_total
if invoice.split_payment:
ImportoTotaleDocumento += invoice.amount_sp
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fiscal_document_type/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
'name': 'Italian Localization - '
'Tipi di documento fiscale per dichiarativi',
'version': '12.0.1.0.0',
'version': '12.0.1.1.0',
'category': 'Localisation/Italy',
'author': "Link It srl, Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/l10n-italy/tree/12.0/'
Expand Down
1 change: 1 addition & 0 deletions l10n_it_fiscal_document_type/data/fiscal.document.type.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ id,code,name,out_invoice,in_invoice,out_refund,in_refund,priority
6,TD10,fattura di acquisto intracomunitario beni,False,True,False,False,3
7,TD11,fattura di acquisto intracomunitario servizi,False,True,False,False,3
8,TD12,documento riepilogativo,False,True,False,False,3
13,TD20,autofattura,True,False,False,False,3
11 changes: 11 additions & 0 deletions l10n_it_fiscal_document_type/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ def _set_document_fiscal_type(self):
if dt:
self.fiscal_document_type_id = dt[0]

@api.model
def create(self, vals):
invoice = super(AccountInvoice, self).create(vals)
if not invoice.fiscal_document_type_id:
dt = self._get_document_fiscal_type(
invoice.type, invoice.partner_id, invoice.fiscal_position_id,
invoice.journal_id)
if dt:
invoice.fiscal_document_type_id = dt[0]
return invoice

def _get_document_fiscal_type(self, type=None, partner=None,
fiscal_position=None, journal=None):
dt = []
Expand Down
5 changes: 5 additions & 0 deletions l10n_it_fiscal_document_type/tests/test_doc_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ def test_doc_type(self):
})
invoice._set_document_fiscal_type()
self.assertEqual(invoice.fiscal_document_type_id.id, self.TD01.id)

invoice2 = self.inv_model.create({
'partner_id': self.partner3.id
})
self.assertEqual(invoice2.fiscal_document_type_id.id, self.TD01.id)