Skip to content

Commit

Permalink
[MIG] l10n_it_corrispettivi_sale: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
monen17 committed Feb 21, 2019
1 parent ad74e59 commit 3e615c6
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 52 deletions.
28 changes: 14 additions & 14 deletions l10n_it_corrispettivi_sale/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
========================================================
Italian Localization - Corrispettivi e ordini di vendita
========================================================
===================================================
Italian Localization - Ricevute e ordini di vendita
===================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
Expand All @@ -14,24 +14,24 @@ Italian Localization - Corrispettivi e ordini di vendita
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_corrispettivi_sale
:target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_corrispettivi_sale
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-11-0/l10n-italy-11-0-l10n_it_corrispettivi_sale
:target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_corrispettivi_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/11.0
:target: https://runbot.odoo-community.org/runbot/122/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Modulo per integrare i corrispettivi in odoo con gli ordini di vendita.
Modulo per integrare le ricevute in Odoo con gli ordini di vendita.

**English**

Module to supplement the corrispettivi with sale orders in odoo.
Module to supplement the receipts with sale orders in Odoo.

**Table of contents**

Expand All @@ -43,21 +43,21 @@ Configuration

**Italiano**

Sull'ordine di vendita, è possibile impostare il flag *Corrispettivi*, ereditato dal partner.
Quando un ordine di vendita ha il flag *Corrispettivi* abilitato, la fattura da esso generata è un corrispettivo.
Sull'ordine di vendita è possibile impostare la casella *Ricevute*, ereditata dal partner.
Quando un ordine di vendita ha la casella *Ricevute* abilitata, la fattura da esso generata è una ricevuta.

**English**

In the sale order, you can set the *Corrispettivi* flag, inherited from the partner.
When a sale order has the *Corrispettivi* flag, the invoice generated by it is a corrispettivo.
In the sale order you can set the *Receipts* flag, inherited from the partner.
When a sale order has the *Receipts* flag, the invoice generated by it is a receipt.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_corrispettivi_sale%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_corrispettivi_sale%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -87,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_corrispettivi_sale>`_ project on GitHub.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_corrispettivi_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
10 changes: 5 additions & 5 deletions l10n_it_corrispettivi_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# Copyright 2018 Simone Rubino - Agile Business Group
# Copyright 2018-2019 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Italian Localization - Corrispettivi e ordini di vendita',
'version': '11.0.1.0.0',
'name': 'Italian Localization - Ricevute e ordini di vendita',
'version': '12.0.1.0.0',
'category': 'Accounting & Finance',
'summary': 'Modulo per integrare i corrispettivi in odoo '
'summary': 'Modulo per integrare le ricevute in Odoo '
'con gli ordini di vendita.',
'author': 'Agile Business Group, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-italy/tree/11.0/'
'website': 'https://github.com/OCA/l10n-italy/tree/12.0/'
'l10n_it_corrispettivi_sale',
'license': 'AGPL-3',
'depends': [
Expand Down
17 changes: 12 additions & 5 deletions l10n_it_corrispettivi_sale/models/sale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Simone Rubino - Agile Business Group
# Copyright 2018-2019 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.addons.account.models.account_invoice import TYPE2JOURNAL
from odoo import models, fields, api
Expand Down Expand Up @@ -36,16 +36,23 @@ def _default_journal_not_corr(self):
if self._context.get('default_journal_id', False):
journal = self.env['account.journal'] \
.browse(self._context.get('default_journal_id'))
if not journal.corrispettivi:
if not journal.corrispettivi: # with this tiny modification
return journal
inv_type = self._context.get('type', 'out_invoice')
inv_types = inv_type if isinstance(inv_type, list) else [inv_type]
company_id = self._context \
.get('company_id', self.env.user.company_id.id)
domain = [
('type', 'in', [_f
for _f in map(TYPE2JOURNAL.get, inv_types) if _f]),
('type', 'in', [TYPE2JOURNAL[ty]
for ty in inv_types if ty in TYPE2JOURNAL]),
('company_id', '=', company_id),
('corrispettivi', '=', False) # with this tiny modification
]
return self.env['account.journal'].search(domain, limit=1)
journal_with_currency = False
if self._context.get('default_currency_id'):
currency_clause = [
('currency_id', '=', self._context.get('default_currency_id'))]
journal_with_currency = self.env['account.journal'] \
.search(domain + currency_clause, limit=1)
return journal_with_currency \
or self.env['account.journal'].search(domain, limit=1)
8 changes: 4 additions & 4 deletions l10n_it_corrispettivi_sale/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**Italiano**

Sull'ordine di vendita, è possibile impostare il flag *Corrispettivi*, ereditato dal partner.
Quando un ordine di vendita ha il flag *Corrispettivi* abilitato, la fattura da esso generata è un corrispettivo.
Sull'ordine di vendita è possibile impostare la casella *Ricevute*, ereditata dal partner.
Quando un ordine di vendita ha la casella *Ricevute* abilitata, la fattura da esso generata è una ricevuta.

**English**

In the sale order, you can set the *Corrispettivi* flag, inherited from the partner.
When a sale order has the *Corrispettivi* flag, the invoice generated by it is a corrispettivo.
In the sale order you can set the *Receipts* flag, inherited from the partner.
When a sale order has the *Receipts* flag, the invoice generated by it is a receipt.
4 changes: 2 additions & 2 deletions l10n_it_corrispettivi_sale/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**Italiano**

Modulo per integrare i corrispettivi in odoo con gli ordini di vendita.
Modulo per integrare le ricevute in Odoo con gli ordini di vendita.

**English**

Module to supplement the corrispettivi with sale orders in odoo.
Module to supplement the receipts with sale orders in Odoo.
24 changes: 12 additions & 12 deletions l10n_it_corrispettivi_sale/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Italian Localization - Corrispettivi e ordini di vendita</title>
<title>Italian Localization - Ricevute e ordini di vendita</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,18 +360,18 @@
</style>
</head>
<body>
<div class="document" id="italian-localization-corrispettivi-e-ordini-di-vendita">
<h1 class="title">Italian Localization - Corrispettivi e ordini di vendita</h1>
<div class="document" id="italian-localization-ricevute-e-ordini-di-vendita">
<h1 class="title">Italian Localization - Ricevute e ordini di vendita</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_corrispettivi_sale"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-11-0/l10n-italy-11-0-l10n_it_corrispettivi_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_corrispettivi_sale"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_corrispettivi_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Modulo per integrare i corrispettivi in odoo con gli ordini di vendita.</p>
<p>Modulo per integrare le ricevute in Odoo con gli ordini di vendita.</p>
<p><strong>English</strong></p>
<p>Module to supplement the corrispettivi with sale orders in odoo.</p>
<p>Module to supplement the receipts with sale orders in Odoo.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -388,18 +388,18 @@ <h1 class="title">Italian Localization - Corrispettivi e ordini di vendita</h1>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p><strong>Italiano</strong></p>
<p>Sull’ordine di vendita, è possibile impostare il flag <em>Corrispettivi</em>, ereditato dal partner.
Quando un ordine di vendita ha il flag <em>Corrispettivi</em> abilitato, la fattura da esso generata è un corrispettivo.</p>
<p>Sull’ordine di vendita è possibile impostare la casella <em>Ricevute</em>, ereditata dal partner.
Quando un ordine di vendita ha la casella <em>Ricevute</em> abilitata, la fattura da esso generata è una ricevuta.</p>
<p><strong>English</strong></p>
<p>In the sale order, you can set the <em>Corrispettivi</em> flag, inherited from the partner.
When a sale order has the <em>Corrispettivi</em> flag, the invoice generated by it is a corrispettivo.</p>
<p>In the sale order you can set the <em>Receipts</em> flag, inherited from the partner.
When a sale order has the <em>Receipts</em> flag, the invoice generated by it is a receipt.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_corrispettivi_sale%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_corrispettivi_sale%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -423,7 +423,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_corrispettivi_sale">OCA/l10n-italy</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_corrispettivi_sale">OCA/l10n-italy</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions l10n_it_corrispettivi_sale/tests/test_corrispettivi_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ def setUp(self):
self.invoice_model = self.env['account.invoice']
self.sale_model = self.env['sale.order']
self.corr_fiscal_position = fiscal_position_model.create({
'name': 'corrispettivi fiscal position',
'name': 'receipts fiscal position',
'corrispettivi': True
})
self.no_corr_fiscal_position = fiscal_position_model.create({
'name': 'corrispettivi fiscal position',
'name': 'receipts fiscal position',
'corrispettivi': False
})
self.corrispettivi_partner = partner_model.create({
'name': 'Corrispettivi partner',
'name': 'Receipts partner',
'use_corrispettivi': True,
'property_account_position_id': self.corr_fiscal_position.id
})
self.no_corrispettivi_partner = partner_model.create({
'name': 'Corrispettivi partner',
'name': 'Receipts partner',
'use_corrispettivi': False,
'property_account_position_id': self.no_corr_fiscal_position.id
})

self.account_receivable = self.env['account.account'].search(
[('user_type_id', '=', self.env.ref(
'account.data_account_type_receivable').id)], limit=1)
self.product = self.env['product.product'].search([], limit=1)
self.product = self.env.ref('sale.advance_product_0')

def create_corr_journal(self):
corr_journal_id = self.env['account.journal'].create({
'name': 'CORR',
'code': 'CORR',
'name': 'RICEV',
'code': 'RICEV',
'type': 'sale',
'corrispettivi': True
})
return corr_journal_id

def create_no_corr_journal(self):
no_corr_journal_id = self.env['account.journal'].create({
'name': 'NOCORR',
'code': 'NOCORR',
'name': 'NORICEV',
'code': 'NORICEV',
'type': 'sale',
'corrispettivi': False
})
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_corrispettivi_sale_onchange(self):

def test_corrispettivi_sale_invoice(self):
"""
Test corrispettivo creation for a sale order having flag corrispettivi.
Test receipt creation for a sale order having flag corrispettivi.
"""
self.create_corr_journal()
sale = self.create_corrispettivi_sale()
Expand Down

0 comments on commit 3e615c6

Please sign in to comment.