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 authored and LucasTran380381 committed Oct 22, 2024
1 parent 7ad55b3 commit bb3a97b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 64 deletions.
2 changes: 1 addition & 1 deletion partner_address_street3/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Street3 in addresses
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:02ed6e826cea014a86dfbe2d8189ccee8d6a0b9f1163112fd6aaf2dd24415aa4
!! source digest: sha256:69099ca9dd86e7091cd6ca9042144c91f6e9c84d3daf47282df91cd3896d5c51
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
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)
2 changes: 1 addition & 1 deletion partner_address_street3/i18n/partner_address_street3.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
25 changes: 17 additions & 8 deletions partner_address_street3/i18n/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-10 03:39+0000\n"
"PO-Revision-Date: 2017-03-10 03:39+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\n"
"PO-Revision-Date: 2024-06-05 16:34+0000\n"
"Last-Translator: jakobkrabbe <[email protected]>\n"
"Language-Team: Swedish (https://www.transifex.com/oca/teams/23907/sv/)\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: partner_address_street3
#: model:ir.model,name:partner_address_street3.model_res_partner
msgid "Contact"
msgstr ""
msgstr "Kontakt"

#. module: partner_address_street3
#: model:ir.model,name:partner_address_street3.model_res_country
msgid "Country"
msgstr ""
msgstr "Land"

#. module: partner_address_street3
#: model:ir.model.fields,help:partner_address_street3.field_res_country__address_format
Expand All @@ -40,24 +41,32 @@ msgid ""
"%(country_name)s: the name of the country\n"
"%(country_code)s: the code of the country"
msgstr ""
"Visningsformat som ska användas för adresser som hör till detta land.\n"
"\n"
"Du kan använda strängmönster i python-stil med alla fält i adressen (använd "
"till exempel \"%(street)s\" för att visa fältet \"street\") plus\n"
"%(state_name)s: namnet på delstaten\n"
"%(state_code)s: delstatens kod\n"
"%(country_name)s: landets namn\n"
"%(country_code)s: landets kod"

#. module: partner_address_street3
#: model:ir.model.fields,field_description:partner_address_street3.field_res_country__address_format
msgid "Layout in Reports"
msgstr ""
msgstr "Layout i rapporter"

#. module: partner_address_street3
#: model:ir.model.fields,field_description:partner_address_street3.field_res_partner__street3
#: model:ir.model.fields,field_description:partner_address_street3.field_res_users__street3
msgid "Street 3"
msgstr ""
msgstr "Gata 3"

#. module: partner_address_street3
#: model_terms:ir.ui.view,arch_db:partner_address_street3.res_partner_view_form_private
#: model_terms:ir.ui.view,arch_db:partner_address_street3.view_partner_address_form
#: model_terms:ir.ui.view,arch_db:partner_address_street3.view_partner_form
msgid "Street 3..."
msgstr ""
msgstr "Street 3..."

#~ msgid "Partner"
#~ msgstr "Företag"
14 changes: 8 additions & 6 deletions 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 All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Street3 in addresses</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:02ed6e826cea014a86dfbe2d8189ccee8d6a0b9f1163112fd6aaf2dd24415aa4
!! source digest: sha256:69099ca9dd86e7091cd6ca9042144c91f6e9c84d3daf47282df91cd3896d5c51
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/partner-contact/tree/17.0/partner_address_street3"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-partner_address_street3"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the base <em>res.partner</em> model by supplying a 3rd line
Expand Down Expand Up @@ -412,7 +412,9 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>
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)
84 changes: 45 additions & 39 deletions partner_address_street3/views/res_partner.xml
Original file line number Diff line number Diff line change
@@ -1,71 +1,77 @@
<odoo>

<record id="view_partner_form" model="ir.ui.view">
<field name="name">add street3 in form view</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath
<field name="name">add street3 in form view</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath
expr="/form/sheet/group/group/div/field[@name='street2']"
position="after"
>
<field
<field
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
</xpath>
<xpath
expr="/form//field[@name='child_ids']/form//field[@name='street2']"
position="after"
>
<field name="street3" placeholder="Street 3..." class="o_address_street" />
</xpath>
<xpath
<field
name="street3"
placeholder="Street 3..."
class="o_address_street"
/>
</xpath>
<xpath
expr="/form//field[@name='child_ids']/kanban/field[@name='street2']"
position="after"
>
<field name="street3" />
</xpath>
</field>
<field name="street3" />
</xpath>
</field>
</record>

<record id="res_partner_kanban_view" model="ir.ui.view">
<field name="name">add street 3 in kanban</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field name="street3" />
<field name="name">add street 3 in kanban</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field name="street3" />
</field>
</field>
</field>
</record>

<record id="view_partner_address_form" model="ir.ui.view">
<field name="name">add street 3 in res.partner.form.address</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_address_form" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field name="street3" placeholder="Street 3..." class="o_address_street" />
<field name="name">add street 3 in res.partner.form.address</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_address_form" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field
name="street3"
placeholder="Street 3..."
class="o_address_street"
/>
</field>
</field>
</field>
</record>

<record id="res_partner_view_form_private" model="ir.ui.view">
<field name="name">add street 3 in res.partner.form.private</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_view_form_private" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field
<field name="name">add street 3 in res.partner.form.private</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_view_form_private" />
<field name="arch" type="xml">
<field name="street2" position="after">
<field
name="street3"
placeholder="Street 3..."
class="o_address_street"
/>
</field>
</field>
</field>
</field>
</record>

</odoo>

0 comments on commit bb3a97b

Please sign in to comment.