This question has been flagged
2138 Views

hello friends..i have a problem changing colour one of the record in list view of purchase order where the condition is whether the expected date less than 15 days the colour of record will change to yellow but if it is exceed than expected date. it will be changed to red colour.. Please ! i need someone to help me ! is Anybody here know the solution to solve my problem? Thank you!

Avatar
Discard

can you add your xml code snippet , if expected date exceeds what color you need to display?

Author

Sorry to reply your message for a long time. if expected date exceeds the color i need to display is red. but how to change colour of field with type date instead we know is only based on status and sorry for cannot showing the xml snippet because i'm so blank and really confused to make it. Anybody, Please help me! someone kindly to help me solve my problem?

Author

if you don't mind i will put my code on here.

Here is my python code and the xml

colour_changing.py

from osv import osv, fields from datetime import datetime from dateutil.relativedelta import relativedelta

class prc_schd(osv.osv): _name = "procurement.order" _inherit = "procurement.order"

def _prepare_automatic_op_procurement(self, cr, uid, product, warehouse, location_id, context=None):
    return {
            'name': _('Automatic OP: %s') % (product.name,),
            'origin': _('SCHEDULER'),
            'date_planned': datetime.today().strftime(DEFAULT_
Author

if you don't mind i will put my code on here.

Here is my python code and the xml

colour_changing.py

from osv import osv, fields from datetime import datetime from dateutil.relativedelta import relativedelta

class prc_schd(osv.osv): _name = "procurement.order" _inherit = "procurement.order"

def _prepare_automatic_op_procurement(self, cr, uid, product, warehouse, location_id, context=None):
    return {
            'name': _('Automatic OP: %s') % (product.name,),
            'origin': _('SCHEDULER'),
            'date_planned': datetime.today().strftime(DEFAULT_