- # --------------------------------------
- # OpenChatter methods and notifications
- # --------------------------------------
-
- def needaction_domain_get(self, cr, uid, ids, context=None):
- return [('state', '=', 'draft')]
-
- def create_send_note(self, cr, uid, ids, context=None):
- return self.message_post(cr, uid, ids, body=_("Request for quotation <b>created</b>."), context=context)
-
- def confirm_send_note(self, cr, uid, ids, context=None):
- for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("Quotation for <em>%s</em> <b>converted</b> to a Purchase Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), context=context)
-
- def shipment_send_note(self, cr, uid, ids, picking_id, context=None):
- for order in self.browse(cr, uid, ids, context=context):
- for picking in (pck for pck in order.picking_ids if pck.id == picking_id):
- # convert datetime field to a datetime, using server format, then
- # convert it to the user TZ and re-render it with %Z to add the timezone
- picking_datetime = fields.DT.datetime.strptime(picking.min_date, DEFAULT_SERVER_DATETIME_FORMAT)
- picking_date_str = fields.datetime.context_timestamp(cr, uid, picking_datetime, context=context).strftime(DATETIME_FORMATS_MAP['%+'] + " (%Z)")
- self.message_post(cr, uid, [order.id], body=_("Shipment <em>%s</em> <b>scheduled</b> for %s.") % (picking.name, picking_date_str), context=context)
-
- def invoice_send_note(self, cr, uid, ids, invoice_id, context=None):
- for order in self.browse(cr, uid, ids, context=context):
- for invoice in (inv for inv in order.invoice_ids if inv.id == invoice_id):
- self.message_post(cr, uid, [order.id], body=_("Draft Invoice of %s %s is <b>waiting for validation</b>.") % (invoice.amount_total, invoice.currency_id.symbol), context=context)
-
- def shipment_done_send_note(self, cr, uid, ids, context=None):
- self.message_post(cr, uid, ids, body=_("""Shipment <b>received</b>."""), context=context)
-
- def invoice_done_send_note(self, cr, uid, ids, context=None):
- self.message_post(cr, uid, ids, body=_("Invoice <b>paid</b>."), context=context)
-
- def draft_send_note(self, cr, uid, ids, context=None):
- return self.message_post(cr, uid, ids, body=_("Purchase Order has been set to <b>draft</b>."), context=context)
-
- def cancel_send_note(self, cr, uid, ids, context=None):
- for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("Purchase Order for <em>%s</em> <b>cancelled</b>.") % (obj.partner_id.name), context=context)
-
-purchase_order()