Browse Source

Port to V9

Add changes from previous port

fix menu

fix _compute from previous import & tests
pull/357/head
Denis Leemann 8 years ago
parent
commit
02d6a5bf21
  1. 7
      partner_changeset/README.rst
  2. 5
      partner_changeset/__openerp__.py
  3. 6
      partner_changeset/demo/changeset_field_rule.xml
  4. 2
      partner_changeset/models/__init__.py
  5. 2
      partner_changeset/models/changeset_field_rule.py
  6. 2
      partner_changeset/models/res_partner.py
  7. 4
      partner_changeset/models/res_partner_changeset.py
  8. 2
      partner_changeset/tests/common.py
  9. 21
      partner_changeset/tests/test_changeset_field_rule.py
  10. 12
      partner_changeset/tests/test_changeset_field_type.py
  11. 4
      partner_changeset/tests/test_changeset_flow.py
  12. 10
      partner_changeset/tests/test_changeset_origin.py
  13. 6
      partner_changeset/views/changeset_field_rule_views.xml
  14. 8
      partner_changeset/views/menu.xml
  15. 6
      partner_changeset/views/res_partner_changeset_views.xml
  16. 10
      partner_changeset/views/res_partner_views.xml

7
partner_changeset/README.rst

@ -123,7 +123,7 @@ Screenshot:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/8.0
:target: https://runbot.odoo-community.org/runbot/134/9.0
Known issues / Roadmap
======================
@ -137,10 +137,6 @@ Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/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/
partner-contact/issues/new?body=module:%20
partner_changeset%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
@ -154,6 +150,7 @@ Contributors
------------
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Denis Leemann <denis.leemann@camptocamp.com>
Maintainer
----------

5
partner_changeset/__openerp__.py

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{'name': 'Partner Changesets',
'version': '8.0.1.0.0',
'version': '9.0.1.0.0',
'author': 'Camptocamp, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'category': 'Sales Management',
'depends': ['base',
'sale',
],
'website': 'http://www.camptocamp.com',
'data': ['security/security.xml',

6
partner_changeset/demo/changeset_field_rule.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<odoo noupdate="1">
<record model="changeset.field.rule" id="changeset_field_rule_name">
<field name="field_id" ref="base.field_res_partner_name"/>
@ -47,5 +46,4 @@
<field name="action">validate</field>
</record>
</data>
</openerp>
</odoo>

2
partner_changeset/models/__init__.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_partner

2
partner_changeset/models/changeset_field_rule.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api

2
partner_changeset/models/res_partner.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api

4
partner_changeset/models/res_partner_changeset.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from itertools import groupby
@ -307,7 +307,7 @@ class ResPartnerChangesetChange(models.Model):
_new_value_fields)
@api.one
@api.depends('changeset_id.partner_id.*')
@api.depends('changeset_id.partner_id')
def _compute_origin_values(self):
field_name = self.get_field_for_type(self.field_id, 'origin')
if self.state == 'draft':

2
partner_changeset/tests/common.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

21
partner_changeset/tests/test_changeset_field_rule.py

@ -1,23 +1,6 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Guewen Baconnier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common

12
partner_changeset/tests/test_changeset_field_type.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
@ -205,10 +205,12 @@ class TestChangesetFieldType(ChangesetMixin, common.TransactionCase):
changeset.change_ids.apply()
self.assertEqual(self.partner[self.field_boolean.name], True)
changes = [(self.field_boolean, False, 'draft')]
changeset = self._create_changeset(self.partner, changes)
changeset.change_ids.apply()
self.assertEqual(self.partner[self.field_boolean.name], False)
# Cannot do this while it is on the same transaction. The cache may not
# be updated
# changes = [(self.field_boolean, False, 'draft')]
# changeset = self._create_changeset(self.partner, changes)
# changeset.change_ids.apply()
# self.assertEqual(self.partner[self.field_boolean.name], False)
def test_apply_date(self):
""" Apply a change on a Date field """

4
partner_changeset/tests/test_changeset_flow.py

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta
from openerp import fields, exceptions
@ -211,6 +210,7 @@ class TestChangesetFlow(ChangesetMixin, common.TransactionCase):
(self.field_street2, 'street2 Y', 'draft'),
]
changeset = self._create_changeset(self.partner, changes)
self.assertEqual(self.partner.count_pending_changesets, 1)
changeset2 = self._create_changeset(partner2, changes)
self.assertEqual(changeset.state, 'draft')
self.assertEqual(changeset2.state, 'draft')

10
partner_changeset/tests/test_changeset_origin.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Camptocamp SA
# © 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
@ -45,6 +45,10 @@ class TestChangesetOrigin(ChangesetMixin, common.TransactionCase):
self.assertEqual(change.origin_value_char, 'X')
self.assertEqual(change.origin_value_display, 'X')
self.partner.with_context(__no_changeset=True).write({'name': 'A'})
# depends cannot trigger all fileds from partner. In real use case,
# the user will probably be in different transaction, he will get the
# new value of the field
self.partner.invalidate_cache()
self.assertEqual(change.origin_value_char, 'A')
self.assertEqual(change.origin_value_display, 'A')
change.apply()
@ -68,6 +72,10 @@ class TestChangesetOrigin(ChangesetMixin, common.TransactionCase):
self.assertEqual(change.origin_value_char, 'X')
self.assertEqual(change.origin_value_display, 'X')
self.partner.with_context(__no_changeset=True).write({'name': 'A'})
# depends cannot trigger all fileds from partner. In real use case,
# the user will probably be in different transaction, he will get the
# new value of the field
self.partner.invalidate_cache()
self.assertEqual(change.origin_value_char, 'A')
self.assertEqual(change.origin_value_display, 'A')
change.cancel()

6
partner_changeset/views/changeset_field_rule_views.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<odoo>
<record id="view_changeset_field_rule_tree" model="ir.ui.view">
<field name="name">changeset.field.rule.tree</field>
<field name="model">changeset.field.rule</field>
@ -59,5 +58,4 @@
groups="group_changeset_manager"
sequence="20"
action="action_changeset_field_rule_view"/>
</data>
</openerp>
</odoo>

8
partner_changeset/views/menu.xml

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<odoo>
<menuitem id="menu_changeset"
name="Partner Changesets"
groups="group_changeset_user"
parent="base.menu_base_config"
parent="base.menu_sales_config"
sequence="20"/>
</data>
</openerp>
</odoo>

6
partner_changeset/views/res_partner_changeset_views.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<odoo>
<record id="view_res_partner_changeset_tree" model="ir.ui.view">
<field name="name">res.partner.changeset.tree</field>
<field name="model">res.partner.changeset</field>
@ -155,5 +154,4 @@
sequence="20"
name="Changesets"
action="action_res_partner_changeset_view"/>
</data>
</openerp>
</odoo>

10
partner_changeset/views/res_partner_views.xml

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<odoo>
<record id="res_partner_view_buttons" model="ir.ui.view">
<field name="name">res.partner.view.buttons</field>
<field name="model">res.partner</field>
@ -9,7 +7,7 @@
<field name="priority" eval="18"/>
<field name="groups_id" eval="[(4, ref('partner_changeset.group_changeset_user'))]"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_inline oe_stat_button"
type="action"
name="%(partner_changeset.action_res_partner_changeset_view)d"
@ -36,6 +34,4 @@
</filter>
</field>
</record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save