Community mailing list archives

community@mail.odoo.com

Re: Issue in the Date

by
hacene.meziani
- 04/23/2016 15:05:33
I will try to do it. Thank you Mohamed

2016-04-21 22:17 GMT+01:00 Mohamed Magdy <moh.magdy40@gmail.com>:
Well, I believe that this field was added by a custom module that you may done by yourself or developed by the community.
Anyway, You should set the default value as a method that will be called each time you create a new record.

If you're using Odoo v7.0, then you need to write it like:

def _set_default_date(self, cr, uid, ids, context=None):
......# Write your logic that will calculate the default value of the date
......# Then return the value calculate

_defaults = {
......'date': _set_default_date(),
}

If you're using Odoo 8.0 or higher, your code should be something like:

@api.one
def _set_default_date(self):
......# Write your logic that will calculate the default value of the date
......# Then return the value calculate

And add this to your field:
date = fields.Date(string='Date', default='_set_default_date', )

==> This code is not accurate, it is just an example.

Thank you 

On Thu, Apr 21, 2016 at 9:34 PM Hacene MEZIANI <hacene.meziani@gmail.com> wrote:
Hi Mohamed,
I did what you've said and I've got the same result that you expected, it shows the new time and date of the new start of the server.
Please, show me where to go to make changes on the good.

Thank in advance.


2016-04-21 16:00 GMT+01:00 Mohamed Magdy <moh.magdy40@gmail.com>:
Hi Hacene,

If the date is the same each time, then I assume the date is the same as you did run the server for the first time.
If you can restart the Odoo server and give another try, it will show the new time and date of the new start of the server.

Well, if you have the result as I described, you have to change a few lines in the code written for the default value of this field.

On Thu, Apr 21, 2016 at 12:44 PM Hacene MEZIANI <hacene.meziani@gmail.com> wrote:
The time zone is correct

2016-04-21 3:14 GMT+01:00 Fabrice Henrion <fhe@odoo.com>:
Do you confirm that your user preferences are properly set and that you don't have a warning icon as shown here:
http://i.imgur.com/xqLtC1K.png

If you have a warning icon, it means that your Odoo user preferences do not match with your computer's regional settings and that Odoo is displaying a different time zone than your actual time zone. This is one reason that could explain a date/time in the past.

__
Fabrice

On Wed Apr 20 16 1:15 PM, Hacene MEZIANI wrote:
sorry,not in the PO but in the request of quotation.
the date order is always in the paste, 
See the attached order that I made today but, it shows a past date.
thanks
2016-04-20 20:32 GMT+01:00 Hacene MEZIANI <hacene.meziani@gmail.com>:
Dear All, I hope you are fine.

I have an issue in the expected date in the PO. It always shows the same date ( paste date)

Please, help me solve this issue.
(see attached picture )
Thanks

 

_______________________________________________


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

--
Best Regards,

Mohamed Magdy
Odoo Technical Team Leader

_______________________________________________

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

--
Best Regards,

Mohamed Magdy
Odoo Technical Team Leader

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe