Warning: include_once(/home/favoledo/robertozanardo.com/wp-content/sunrise.php): Failed to open stream: No such file or directory in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52

Warning: include_once(): Failed opening '/home/favoledo/robertozanardo.com/wp-content/sunrise.php' for inclusion (include_path='.:/opt/alt/php83/usr/share/pear:/opt/alt/php83/usr/share/php:/usr/share/pear:/usr/share/php') in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52
azioni automatiche odoo

Azioni automatiche in Odoo

Come impostare da codice le azioni automatiche in Odoo, ad esempio in un modulo aggiuntivo.

Creiamo l’xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record forcecreate="True" id="ir_cron_ticket_close" model="ir.cron">
<field name="name">Close Ticket after 24H solved</field>
<field eval="True" name="active" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field eval="'crm.claim'" name="model"/>
<field eval="'close_ticket'" name="function"/>
<field eval="'()'" name="args" />
</record>

</data>
</openerp>

Definiamo l’azione nel codice python:


class ClaimsTicket(models.Model):
_inherit = 'crm.claim'

@api.model
def close_ticket(self):
    ticket_ids = self.search([])
    out_file = open("c:\\temp\\dev_log.txt","w")
    for ticket in ticket_ids:
       if (ticket.stage_id.id==3):
          time_difference = datetime.now() - datetime.strptime(ticket.date_solved, "%Y-%m-%d %H:%M:%S")
          #time_difference.total_seconds()
          giorno = datetime.strptime(ticket.date_solved, "%Y-%m-%d %H:%M:%S").weekday()
          passed_hours = time_difference.total_seconds()/3600
          out_file.write('giorno:%s ore trascorse:%s\n' % (str(giorno),str(passed_hours)))
          if (passed_hours>48):
               ticket.write({'stage_id': 5,'date_closed': fields.datetime.now()})
   out_file.close()
return True

Lascia un commento

betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betpark
betgaranti
betpark
betgaranti
betpark
betgaranti
Kolaybet
kolaybet
betpark
betpark
betpark
betnano
betnano
betpark
betpark
betpark
betpark
marsbahis
marsbahis
betpark
betpark
betpark
betpark
betpark
kolaybet
betpark
kolaybet giriş
Katla
Katlabet
nitrobahis
katlabet
kolaybet
kolaybet
hellocasino
hellocasino
betgaranti
Kolaybet
kolaybet
grandpashabet
grandpashabet
grandpashabet
sahabet
sahabet
onwin
bettilt
bettilt
sahabet
sahabet
sahabet
holiganbet
sahabet
onwin
sahabet
sahabet
sahabet
onwin
onwin
onwin
sahabet
grandpashabet
sahabet
Kolaybet
grandpashabet
onwin