Browse Source

[IMP] partner_tz: black, isort

14.0
Akim Juillerat 5 years ago
committed by Dũng (Trần Đình)
parent
commit
a25da01e7c
  1. 1
      partner_tz/__init__.py
  2. 1
      partner_tz/models/__init__.py
  3. 10
      partner_tz/models/res_partner.py
  4. 3
      partner_tz/readme/DESCRIPTION.rst
  5. 8
      partner_tz/readme/ROADMAP.rst
  6. 7
      partner_tz/tools/__init__.py
  7. 6
      partner_tz/tools/tz_utils.py
  8. 2
      partner_tz/views/res_partner.xml

1
partner_tz/__init__.py

@ -1,2 +1 @@
from . import models
from . import tools

1
partner_tz/models/__init__.py

@ -1 +0,0 @@
from . import res_partner

10
partner_tz/models/res_partner.py

@ -1,10 +0,0 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
tz = fields.Selection(default=None)

3
partner_tz/readme/DESCRIPTION.rst

@ -1,3 +1,2 @@
This module removes timezone default value on res.partner and display the field
on form view.
This module displays the timezone field on partner form view.
Moreover it provides a few tools function in `tools/tz_utils.py`.

8
partner_tz/readme/ROADMAP.rst

@ -0,0 +1,8 @@
* Odoo default value for timezone field uses the tz set on the connected user.
So if a user creates a partner located in a different timezone than his own,
the created partner will be set in the user's timezone instead of having the
timezone from its own location.
Ideally, we should change this behaviour to get the timezone from the country
and city of the partner when they are defined.
http://www.geonames.org/export/web-services.html#timezone might be a good
starting point.

7
partner_tz/tools/__init__.py

@ -1 +1,6 @@
from .tz_utils import *
from .tz_utils import tz_to_tz_naive_datetime
from .tz_utils import tz_to_utc_naive_datetime
from .tz_utils import utc_to_tz_naive_datetime
from .tz_utils import tz_to_tz_time
from .tz_utils import tz_to_utc_time
from .tz_utils import utc_to_tz_time

6
partner_tz/tools/tz_utils.py

@ -1,10 +1,10 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
import pytz
from datetime import datetime, date
from datetime import date, datetime
import pytz
UTC_TZ = pytz.timezone('UTC')
UTC_TZ = pytz.timezone("UTC")
def tz_to_tz_naive_datetime(from_tz, to_tz, date_time):

2
partner_tz/views/res_partner.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_partner_form_inherit" model="ir.ui.view">
<field name="name">res.partner.form.inherit</field>

Loading…
Cancel
Save