Skip to content

Commit

Permalink
[MIG] partner_address_street3: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gurneyalex committed Dec 8, 2023
1 parent 2307764 commit fe0605a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions partner_address_street3/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
"name": "Street3 in addresses",
"summary": "Add a third address line on partners",
"license": "AGPL-3",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"maintainer": "Camptocamp",
"category": "Sales",
"depends": ["base_view_inheritance_extension"],
"website": "https://github.com/OCA/partner-contact",
"data": ["views/res_partner.xml"],
"post_init_hook": "post_init_hook",
Expand Down
10 changes: 5 additions & 5 deletions partner_address_street3/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


def post_init_hook(cr, registry):
def post_init_hook(env):
"""Add street3 to address format"""
query = """
UPDATE res_country
Expand All @@ -12,10 +12,10 @@ def post_init_hook(cr, registry):
E'%(street2)s\n%(street3)s\n'
)
"""
cr.execute(query)
env.cr.execute(query)


def uninstall_hook(cr, registry):
def uninstall_hook(env):
"""Remove street3 from address format"""
# Remove %(street3)s\n from address_format
query = """
Expand All @@ -26,7 +26,7 @@ def uninstall_hook(cr, registry):
''
)
"""
cr.execute(query)
env.cr.execute(query)

# Remove %(street3)s from address_format
query = """
Expand All @@ -37,4 +37,4 @@ def uninstall_hook(cr, registry):
''
)
"""
cr.execute(query)
env.cr.execute(query)
1 change: 0 additions & 1 deletion partner_address_street3/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
4 changes: 2 additions & 2 deletions partner_address_street3/tests/test_street_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def test_partner(self):
def test_post_init_hook(self):
from ..hooks import post_init_hook

post_init_hook(self.env.cr, None)
post_init_hook(self.env)
us_country = self.env.ref("base.us")
self.assertTrue("%(street3)s" in us_country.address_format)

def test_uninstall(self):
from ..hooks import uninstall_hook

uninstall_hook(self.env.cr, None)
uninstall_hook(self.env)
us_country = self.env.ref("base.us")
self.assertTrue("%(street3)s" not in us_country.address_format)
2 changes: 1 addition & 1 deletion partner_address_street3/views/res_partner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
name="street3"
placeholder="Street 3..."
class="o_address_street"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
readonly="type == 'contact' and parent_id != False"
/>
</xpath>
<xpath
Expand Down

0 comments on commit fe0605a

Please sign in to comment.