diff options
| author | yhu-odoo <yhu@odoo.com> | 2020-04-21 15:22:46 +0000 |
|---|---|---|
| committer | yhu-odoo <yhu@odoo.com> | 2020-05-27 08:20:17 +0000 |
| commit | 181c7d82e30d0848bbac7f7d0188e81aced0af07 (patch) | |
| tree | d5868d318629c09ebb4da9d70ac2316d66fde338 /addons/purchase/data | |
| parent | d83334ef8ee566e56ad8b25264d66704120ba598 (diff) | |
[IMP] purchase: send reminder mail to vendor
1. automatically send a reminder mail to vendor to confirm the receipt
date. If confirmed, (confirmed by vendor) will be added next to the
receipt date. If not, vendor can update the date on the portal website.
An warning activity will be set for the purchase representative for this
update.
2. Vendor can also comfirm recieption of the PO when we 'send PO by mail'.
If confirm, (confirmed by vendor) will be added next to the confirmation
date. An filter is added in the PO search view to show all unconfirmed
PO.
Task 2230811
PR #49921
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/purchase/data')
| -rw-r--r-- | addons/purchase/data/ir_cron_data.xml | 15 | ||||
| -rw-r--r-- | addons/purchase/data/mail_template_data.xml | 79 | ||||
| -rw-r--r-- | addons/purchase/data/purchase_data.xml | 14 |
3 files changed, 104 insertions, 4 deletions
diff --git a/addons/purchase/data/ir_cron_data.xml b/addons/purchase/data/ir_cron_data.xml new file mode 100644 index 00000000000..3c70792ceb6 --- /dev/null +++ b/addons/purchase/data/ir_cron_data.xml @@ -0,0 +1,15 @@ +<?xml version='1.0' encoding='utf-8'?> +<odoo> + <record forcecreate="True" id="purchase_send_reminder_mail" model="ir.cron"> + <field name="name">Purchase reminder</field> + <field name="active" eval="True" /> + <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 name="doall">1</field> + <field name="model_id" ref="model_purchase_order"/> + <field name="state">code</field> + <field name="code">model._send_reminder_mail()</field> + </record> +</odoo> diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml index dff26e49227..35bd59cf12c 100644 --- a/addons/purchase/data/mail_template_data.xml +++ b/addons/purchase/data/mail_template_data.xml @@ -49,11 +49,46 @@ with reference: ${object.partner_ref} % endif amounting in <strong>${format_amount(object.amount_total, object.currency_id)}</strong> - from ${object.company_id.name}. - <br/><br/> - If you have any questions, please do not hesitate to contact us. + from ${object.company_id.name}. + % if object.date_planned or object.expected_date: + The receipt is planned for + % if object.date_planned: + <strong>${object.date_planned.date()}</strong>. + % elif object.expected_date: + <strong>${object.expected_date.date()}</strong>. + % endif + <br/><br/> + Could you please acknowledge the receipt of this order? + % endif + </p> +</div></field> + <field name="report_template" ref="action_report_purchase_order"/> + <field name="report_name">PO_${(object.name or '').replace('/','_')}</field> + <field name="lang">${object.partner_id.lang}</field> + <field name="auto_delete" eval="True"/> + </record> + + <record id="email_template_edi_purchase_reminder" model="mail.template"> + <field name="name">Purchase Order: Vendor Reminder</field> + <field name="model_id" ref="purchase.model_purchase_order"/> + <field name="email_from">${(object.user_id.email_formatted or user.email_formatted) |safe}</field> + <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field> + <field name="partner_to">${object.partner_id.id}</field> + <field name="body_html" type="html"> +<div style="margin: 0px; padding: 0px;"> + <p style="margin: 0px; padding: 0px; font-size: 13px;"> + Dear ${object.partner_id.name} + % if object.partner_id.parent_id: + (${object.partner_id.parent_id.name}) + % endif <br/><br/> - Best regards, + Here is a reminder that the delivery of the purchase order <strong>${object.name}</strong> is planned for + % if object.date_planned: + <strong>${object.date_planned.date()}</strong>. + % else: + <strong>${object.expected_date.date()}</strong>. + % endif + Could you please confirm it will be on time? </p> </div></field> <field name="report_template" ref="action_report_purchase_order"/> @@ -61,5 +96,41 @@ <field name="lang">${object.partner_id.lang}</field> <field name="auto_delete" eval="True"/> </record> + + <template id="mail_notification_confirm" inherit_id="mail.mail_notification_paynow" name="Purchase: Confirmation mail notification template"> + <xpath expr="//t[@t-set='access_name']" position="after"> + <t t-if="record._name == 'purchase.order'"> + <t t-if="record.state == 'purchase' and not record.env.context.get('is_reminder')"> + <t t-set="access_name">Confirm</t> + <t t-set="access_url" t-value="record.get_confirm_url(confirm_type='reception')"/> + </t> + </t> + </xpath> + <xpath expr="//a[@t-att-href='access_url']" position="replace"> + <t t-if="record._name == 'purchase.order' and record.env.context.get('is_reminder')"> + <a t-att-href="record.get_confirm_url(confirm_type='reminder')" + style="margin-right: 10px; background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;"> + Yes + </a> + <a t-att-href="record.get_update_url()" + style="margin-left: 10px; background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;"> + No, Update Dates + </a> + <div>&nbsp;</div> + <div style="margin: 0px; padding: 0px; font-size:13px; text-align: left;"> + If you have any questions, please do not hesitate to contact us. + <div>&nbsp;</div> + Best regards, + </div> + </t> + <t t-else=""> + <a t-att-href="access_url" + style="margin-left: 10px; background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;"> + <t t-esc="access_name"/> + </a> + </t> + </xpath> + </template> + </data> </odoo> diff --git a/addons/purchase/data/purchase_data.xml b/addons/purchase/data/purchase_data.xml index d4360ef74d4..fa1af422096 100644 --- a/addons/purchase/data/purchase_data.xml +++ b/addons/purchase/data/purchase_data.xml @@ -36,5 +36,19 @@ <field name="state">code</field> <field name="code">action = records.action_share()</field> </record> + + <!-- Default value for company_dependant field --> + <record forcecreate="True" id="receipt_reminder_email" model="ir.property"> + <field name="name">receipt_reminder_email</field> + <field name="type" eval="'boolean'"/> + <field name="fields_id" search="[('model','=','res.partner'),('name','=','receipt_reminder_email')]"/> + <field eval="True" name="value"/> + </record> + <record forcecreate="True" id="reminder_date_before_receipt" model="ir.property"> + <field name="name">reminder_date_before_receipt</field> + <field name="type" eval="'integer'"/> + <field name="fields_id" search="[('model','=','res.partner'),('name','=','reminder_date_before_receipt')]"/> + <field eval="1" name="value"/> + </record> </data> </odoo> |
