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

[14.0][MIG] l10n_it_dichiarazione_intento #2043

Merged
merged 29 commits into from
Oct 1, 2021

Conversation

SimoRubi
Copy link
Member

@SimoRubi SimoRubi commented Jan 15, 2021

Migrazione da v12 (https://github.com/OCA/l10n-italy/tree/f8ffdba23af2a8dfd863544d8bb311c555079bf1/l10n_it_dichiarazione_intento)

cose da fare:

  • test automatici
  • rebase
  • script di migrazione v13 (account.invoice* -> account.move*)
    Fatti direttamente verso i nuovi nomi in inglese
  • rinominare il modulo in l10n_it_declaration_of_intent + migrazione con update_module_names

--
Confermo di aver firmato il CLA https://odoo-community.org/page/cla e di aver letto le linee guida su https://odoo-community.org/page/contributing

@SimoRubi SimoRubi mentioned this pull request Jan 15, 2021
76 tasks
@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch 3 times, most recently from 86816b3 to 3270a6b Compare January 15, 2021 10:39
@andreampiovesana
Copy link
Contributor

forse bisogna rinominare il modulo in inglese?
l10n_it_declaration_of_intent

@SimoRubi
Copy link
Member Author

forse bisogna rinominare il modulo in inglese?
l10n_it_declaration_of_intent

Sì è una delle cose che devo fare.
Prima punto a farlo funzionare, poi lo rinomino con script di migrazione

@eLBati
Copy link
Member

eLBati commented Jan 27, 2021

#1938 (comment)

@SimoRubi
Copy link
Member Author

#1938 (comment)

sì grazie, come ho scritto sopra vorrei prima arrivare a far funzionare il modulo così com'è, poi lo rinomino.
Ho aggiunto in descrizione le cose che rimangono da fare

@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch 5 times, most recently from e0838a3 to d16ebfa Compare March 31, 2021 16:05
@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch 2 times, most recently from 0f93fbb to ab4ef74 Compare April 14, 2021 16:11
@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch 3 times, most recently from 11979d4 to 52e4bfd Compare May 20, 2021 08:49
@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch 4 times, most recently from 72aa0a1 to 7f68fa3 Compare June 15, 2021 14:23
@SimoRubi SimoRubi marked this pull request as ready for review June 16, 2021 07:13
@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch from 7f68fa3 to 65acd08 Compare June 16, 2021 07:18
@TheMule71
Copy link
Contributor

Ciao, non ti faccio la PR perché sono due modifiche banali:

probabilmente sia la valuta che il plafond corretti sono quelli della company corrent (scelta dal dropdown) e non quelli della company di default dell'utente corrente.

diff --git a/l10n_it_declaration_of_intent/models/declaration.py b/l10n_it_declaration_of_intent/models/declaration.py
index 8e7e20f5c6..d59d852f2c 100644
--- a/l10n_it_declaration_of_intent/models/declaration.py
+++ b/l10n_it_declaration_of_intent/models/declaration.py
@@ -41,7 +41,7 @@ class DeclarationOfIntent(models.Model):
 
     @api.model
     def _default_currency(self):
-        return self.env.user.company_id.currency_id
+        return self.env.company.currency_id
 
     number = fields.Char(copy=False)
     date = fields.Date(required=True)
@@ -94,7 +94,7 @@ class DeclarationOfIntent(models.Model):
         # Declaration issued by company are "IN"
         if values.get("type", False) == "in":
             year = fields.Date.to_date(values["date_start"]).strftime("%Y")
-            plafond = self.env.user.company_id.declaration_yearly_limit_ids.filtered(
+            plafond = self.env.company.declaration_yearly_limit_ids.filtered(
                 lambda r: r.year == year
             )
             if not plafond:
diff --git a/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py b/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
index aa37cfc1a3..f4ce368202 100644
--- a/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
+++ b/l10n_it_declaration_of_intent/tests/test_declaration_of_intent.py
@@ -187,7 +187,7 @@ class TestDeclarationOfIntent(SavepointCase):
             {
                 "year": self.today_date.year,
                 "limit_amount": 50000.0,
-                "company_id": self.env.user.company_id.id,
+                "company_id": self.env.company.id,
             }
         )
         self.declaration4 = self._create_declaration(self.partner4, "in")

@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch from 65acd08 to 4bec373 Compare July 2, 2021 13:18
@SimoRubi
Copy link
Member Author

SimoRubi commented Jul 2, 2021

Grazie, ho corretto.
A meno di casi eccezionali dove vengono passate cose nel contesto (vedi https://github.com/odoo/odoo/blob/9b7a4e1815de580575bed6657f9f8915907ce534/odoo/api.py#L555) i due valori coincidono, ma concordo che è più corretto prendere la company direttamente dal environment

@TheMule71
Copy link
Contributor

Grazie, ho corretto.
A meno di casi eccezionali dove vengono passate cose nel contesto (vedi https://github.com/odoo/odoo/blob/9b7a4e1815de580575bed6657f9f8915907ce534/odoo/api.py#L555) i due valori coincidono, ma concordo che è più corretto prendere la company direttamente dal environment

Non credo sia così raro nella 14. Se quello che dice il commento è vero:
https://github.com/odoo/odoo/blob/9b7a4e1815de580575bed6657f9f8915907ce534/odoo/api.py#L595-L597
avere le company specificate nel contesto è la norma...

@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch from d02e800 to 9ed7e30 Compare September 24, 2021 10:46
Switch to SavepointCase to speed up tests

price subtotal is the base amount for taxes in tax_ids

remove propagation from invoice line to move line generation (now they are the same)

detect tax lines based on tax_ids

use invoice date instead of date in invoice

Fix declaration amounts update

Remove unused account

create invoice and refund with Form

account is now only in lines
new refund creations
new method names for post and cancel

account.invoice.type renamed to account.move.move_type.

Manage new type 'Entry'

Rewrite configuration steps

Regenerate translations due to deprecated format:
odoo.tools.translate: Skipped deprecated occurrence selection:dichiarazione.intento,state
odoo.tools.translate: Skipped deprecated occurrence selection:dichiarazione.intento,type

ACL for wizard required in v14

ir.actions.act_window.view_type does not exist anymore

rename account.invoice.date_invoice to account.move.date

rename account.invoice* to account.move* in Python

remove api.multi

split too complex method:
l10n_it_dichiarazione_intento/models/account_invoice.py:59:5: C901 'AccountInvoice.action_move_create' is too complex (27)

Add contributor for migration

Manifest reformat
…ing optimizations available in 14.0.

Use common accounting methods for tests setup
Roadmap comment on currency
Shortcut for purchase and sale documents
Simplify amount computation for declaration lines
Check move_type only for short_type computation
Apply date filter only if there is a date
Copy link
Contributor

@TheMule71 TheMule71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SimoRubi SimoRubi force-pushed the 14.0-mig-l10n_it_dichiarazione_intento branch from 9ed7e30 to cf763cd Compare September 24, 2021 10:56
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@SimoRubi
Copy link
Member Author

@OCA/local-italy-maintainers che dite si può mergiare?
Ho provato a fare rebase per includere le nuove modifiche di v12 ma viene un macello visto anche il renaming fatto in questa PR, se qualcuno vuole cimentarsi comunque può fare una PR al branch di questa PR.

Le issue da portare al momento sono:

@TheMule71
Copy link
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-2043-by-TheMule71-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 381c9b5 into OCA:14.0 Oct 1, 2021
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 3ab6add. Thanks a lot for contributing to OCA. ❤️

TheMule71 added a commit to odoo-italia/l10n-italy that referenced this pull request Oct 1, 2021
TheMule71 added a commit to odoo-italia/l10n-italy that referenced this pull request Oct 8, 2021
TheMule71 added a commit to odoo-italia/l10n-italy that referenced this pull request Oct 15, 2021
TheMule71 added a commit to TheMule71/l10n-italy that referenced this pull request Jan 21, 2022
TheMule71 added a commit to TheMule71/l10n-italy that referenced this pull request Jan 21, 2022
TheMule71 added a commit to odoo-italia/l10n-italy that referenced this pull request Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.