2
0

[MIG] account_lock_date_update: Migration to v14

Co-authored-by: Alexis de Lattre <alexis@via-dot-ecp-dot-fr>
This commit is contained in:
João Marques 2021-05-18 15:24:41 +01:00 committed by syera bonneaux
parent 7e65bedc7b
commit 1835727018
7 changed files with 33 additions and 36 deletions

View File

@ -14,13 +14,13 @@ Account Lock Date Update
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_lock_date_update :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_lock_date_update
:alt: OCA/account-financial-tools :alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_lock_date_update :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_lock_date_update
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/13.0 :target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -36,7 +36,7 @@ access to all technical settings.
Usage Usage
===== =====
To use this module, you need to be an account adviser and go to: To use this module, you need to be a Billing Administrator and go to:
* Invoicing -> Accounting -> Actions -> Update accounting lock dates * Invoicing -> Accounting -> Actions -> Update accounting lock dates
* Change values and click on update button * Change values and click on update button
@ -47,7 +47,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_lock_date_update%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_lock_date_update%0Aversion:%2014.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. Do not contact contributors directly about support or help with technical issues.
@ -80,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_lock_date_update>`_ project on GitHub. This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_lock_date_update>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -6,11 +6,14 @@
"summary": """ "summary": """
Allow an Account adviser to update locking date without having Allow an Account adviser to update locking date without having
access to all technical settings""", access to all technical settings""",
"version": "13.0.1.0.0", "version": "14.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)", "author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools", "website": "https://github.com/OCA/account-financial-tools",
"installable": True, "installable": True,
"depends": ["account"], "depends": ["account"],
"data": ["wizards/account_update_lock_date.xml"], "data": [
"security/ir.model.access.csv",
"wizards/account_update_lock_date.xml",
],
} }

View File

@ -1,4 +1,4 @@
To use this module, you need to be an account adviser and go to: To use this module, you need to be a Billing Administrator and go to:
* Invoicing -> Accounting -> Actions -> Update accounting lock dates * Invoicing -> Accounting -> Actions -> Update accounting lock dates
* Change values and click on update button * Change values and click on update button

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_update_lock_date_full,Full access on account.update.lock_date,model_account_update_lock_date,account.group_account_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_update_lock_date_full Full access on account.update.lock_date model_account_update_lock_date account.group_account_manager 1 1 1 1

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Account Lock Date Update</title> <title>Account Lock Date Update</title>
<style type="text/css"> <style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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/account-financial-tools/tree/13.0/account_lock_date_update"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_lock_date_update"><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/92/13.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/account-financial-tools/tree/14.0/account_lock_date_update"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_lock_date_update"><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/92/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Allow an Account adviser to update locking date without having <p>Allow an Account adviser to update locking date without having
access to all technical settings.</p> access to all technical settings.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@ -385,7 +385,7 @@ access to all technical settings.</p>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>To use this module, you need to be an account adviser and go to:</p> <p>To use this module, you need to be a Billing Administrator and go to:</p>
<ul class="simple"> <ul class="simple">
<li>Invoicing -&gt; Accounting -&gt; Actions -&gt; Update accounting lock dates</li> <li>Invoicing -&gt; Accounting -&gt; Actions -&gt; Update accounting lock dates</li>
<li>Change values and click on update button</li> <li>Change values and click on update button</li>
@ -396,7 +396,7 @@ access to all technical settings.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_lock_date_update%0Aversion:%2013.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/account-financial-tools/issues/new?body=module:%20account_lock_date_update%0Aversion:%2014.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -423,7 +423,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_lock_date_update">OCA/account-financial-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_lock_date_update">OCA/account-financial-tools</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> <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>
</div> </div>

View File

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields from odoo import fields
from odoo.exceptions import UserError from odoo.exceptions import AccessError
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
@ -12,28 +12,24 @@ class TestAccountLockDateUpdate(TransactionCase):
self.company = self.env.ref("base.main_company") self.company = self.env.ref("base.main_company")
self.demo_user = self.env.ref("base.user_demo") self.demo_user = self.env.ref("base.user_demo")
self.adviser_group = self.env.ref("account.group_account_manager") self.adviser_group = self.env.ref("account.group_account_manager")
self.UpdateLockDateUpdateObj = self.env["account.update.lock_date"].with_user(
self.demo_user
)
def create_account_lock_date_update(self):
return self.UpdateLockDateUpdateObj.create({"company_id": self.company.id})
def test_01_update_without_access(self): def test_01_update_without_access(self):
wizard = self.create_account_lock_date_update()
wizard.write(
{"period_lock_date": "2000-01-01", "fiscalyear_lock_date": "2000-01-01"}
)
self.demo_user.write({"groups_id": [(3, self.adviser_group.id)]}) self.demo_user.write({"groups_id": [(3, self.adviser_group.id)]})
with self.assertRaises(UserError): with self.assertRaises(AccessError):
wizard.with_user(self.demo_user.id).execute() self.env["account.update.lock_date"].with_user(self.demo_user.id).create(
{"company_id": self.company.id}
)
def test_02_update_with_access(self): def test_02_update_with_access(self):
wizard = self.create_account_lock_date_update() self.demo_user.write({"groups_id": [(4, self.adviser_group.id)]})
wizard = (
self.env["account.update.lock_date"]
.with_user(self.demo_user.id)
.create({"company_id": self.company.id})
)
wizard.write( wizard.write(
{"period_lock_date": "2000-02-01", "fiscalyear_lock_date": "2000-01-01"} {"period_lock_date": "2000-02-01", "fiscalyear_lock_date": "2000-01-01"}
) )
self.demo_user.write({"groups_id": [(4, self.adviser_group.id)]})
wizard.with_user(self.demo_user.id).execute() wizard.with_user(self.demo_user.id).execute()
self.assertEqual( self.assertEqual(
fields.Date.to_string(self.company.period_lock_date), "2000-02-01" fields.Date.to_string(self.company.period_lock_date), "2000-02-01"

View File

@ -11,12 +11,12 @@
<form> <form>
<header /> <header />
<sheet> <sheet>
<group> <group id="main">
<group> <group id="main-left">
<field name="company_id" invisible="1" /> <field name="company_id" invisible="1" />
<field name="period_lock_date" /> <field name="period_lock_date" />
</group> </group>
<group> <group id="main-right">
<field name="fiscalyear_lock_date" /> <field name="fiscalyear_lock_date" />
</group> </group>
</group> </group>
@ -43,10 +43,6 @@
<field name="name">Update accounting lock dates</field> <field name="name">Update accounting lock dates</field>
<field name="parent_id" ref="account.menu_finance_entries_actions" /> <field name="parent_id" ref="account.menu_finance_entries_actions" />
<field name="action" ref="account_update_lock_date_act_window" /> <field name="action" ref="account_update_lock_date_act_window" />
<field
name="groups_id"
eval="[(6, 0, [ref('account.group_account_manager')])]"
/>
<field name="sequence" eval="70" /> <field name="sequence" eval="70" />
</record> </record>
</odoo> </odoo>