diff options
| author | Rohan Patel <rop@odoo.com> | 2018-01-10 12:54:39 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-01-24 13:08:27 +0000 |
| commit | 4ba8f51d87be394988e6e2889cf03f351afea1a0 (patch) | |
| tree | 0d7a6c49f3c494789d0c99a4cb4ae7bb9b24bc98 /addons/hr_expense/data | |
| parent | af1728fddf61c0bc35c4fd7a9c139ab7b1feefd0 (diff) | |
[IMP] hr_expense: improve mail gateaway
1/ Send mail notification if expense is registered successfully
Before this commit, when user submits the expense via email, user is not getting
information about whether expense is registered or not. After this commit user
will get a confirmation email.
Few other usability improvements,
- Improved tooltip for the field 'default_code' in expense's form and in the
'Emails' config setting.
- Added product's default code in product's kanban view
- Filtered uom based on category of product's uom.
2/ Better parsing of expense mail subject
Criteria for matching expense product from email subject is changed,
- The product code should be the first word of the subject.
- Only expense products are allowed, previously there was no filter and user was
able to select any product in expense via mail.
Currency support is added,
- Now user can specify currency symbols and ISO code in expense mail subject.
- If subject contains multiple numbers in that case, number with currency will
get higher priory, and it selected as an amount in expense.
- If multi currency is active, user can use any active currency symbol/ISO code
in mail subject. Respective currency will be selected in registered expense.
- If multi currency is not active, user can only pass company currency. Other
currencies are ignored and expense will be registered as default company currency
- If user pass non active currency in subject then that currency will be ignored
and expense will be registered as default company currency
Examples:
PROD_CODE 2 foo $1205.91 baz
Added python test cases for mail subject parsing.
Related to task #35093
closes #22168
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
Diffstat (limited to 'addons/hr_expense/data')
| -rw-r--r-- | addons/hr_expense/data/hr_expense_data.xml | 15 | ||||
| -rw-r--r-- | addons/hr_expense/data/hr_expense_demo.xml | 10 | ||||
| -rw-r--r-- | addons/hr_expense/data/mail_data.xml | 45 |
3 files changed, 55 insertions, 15 deletions
diff --git a/addons/hr_expense/data/hr_expense_data.xml b/addons/hr_expense/data/hr_expense_data.xml deleted file mode 100644 index 5a733714722..00000000000 --- a/addons/hr_expense/data/hr_expense_data.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<odoo> - <data noupdate="1"> - - <record id="product_product_fixed_cost" model="product.product"> - <field name="name">Expenses</field> - <field name="list_price">0.0</field> - <field name="standard_price">1.0</field> - <field name="type">service</field> - <field name="default_code">EXP_GEN</field> - <field name="categ_id" ref="product.cat_expense"/> - <field name="can_be_expensed" eval="True"/> - </record> - </data> -</odoo> diff --git a/addons/hr_expense/data/hr_expense_demo.xml b/addons/hr_expense/data/hr_expense_demo.xml index 975013c13db..b3ea6145ab7 100644 --- a/addons/hr_expense/data/hr_expense_demo.xml +++ b/addons/hr_expense/data/hr_expense_demo.xml @@ -59,6 +59,16 @@ <!-- ++++++++++++++ Expense sheet for Admin ++++++++++++++--> + <record id="product_product_fixed_cost" model="product.product"> + <field name="name">Expenses</field> + <field name="list_price">0.0</field> + <field name="standard_price">1.0</field> + <field name="type">service</field> + <field name="default_code">EXP_GEN</field> + <field name="categ_id" ref="product.cat_expense"/> + <field name="can_be_expensed" eval="True"/> + </record> + <record id="screen_expense" model="hr.expense"> <field name="name">Screen</field> <field name="employee_id" ref="hr.employee_admin"/> diff --git a/addons/hr_expense/data/mail_data.xml b/addons/hr_expense/data/mail_data.xml index bc095de21ca..8d216a0ddbf 100644 --- a/addons/hr_expense/data/mail_data.xml +++ b/addons/hr_expense/data/mail_data.xml @@ -44,5 +44,50 @@ </ul> </template> + <template id="hr_expense_template_register"> + <p>Dear <t t-esc="expense.employee_id.name"/>,</p> + <p> + Your expense has been successfully registered. + <t t-if="expense.employee_id.user_id"> + You can now submit it to the manager from the following link. + </t> + </p> + <p t-if="expense.product_id"> + Product: <t t-esc="expense.product_id.name"/> + </p> + <div t-else=""> + <p>Product: not found</p> + <p>The first word of the email subject did not correspond to any product code. You'll have to set the product manually on the expense.</p> + </div> + <p> + Price: <t t-esc="expense.unit_amount"/><t t-esc="expense.currency_id.symbol"/> + </p> + <p t-if="expense.employee_id.user_id"> + <br/> + <a t-att-href="'/web#id=%s&model=hr.expense&view_type=form' % (expense.id)" style="background-color: #9E588B; margin-top: 10px; padding: 10px; text-decoration: none; color: #fff; border-radius: 5px; font-size: 16px;">View Expense</a> + </p> + </template> + + <template id="hr_expense_template_register_no_user"> + <div style="background:#F0F0F0;color:#515166;padding:10px 0px;font-family:Arial,Helvetica,sans-serif;font-size:14px;"> + <table style="width:600px;margin:5px auto;"> + <tbody> + <tr> + <td><a href="/"><img src="/web/binary/company_logo" style="vertical-align:baseline;max-width:100px;" /></a></td> + </tr> + </tbody> + </table> + <table style="width:600px;margin:0px auto;background:white;border:1px solid #e1e1e1;"> + <tbody> + <tr> + <td style="padding:15px 20px 10px 20px;"> + <t t-call="hr_expense.hr_expense_template_register"/> + <p style="color:#9E588B;">Powered by <a target="_blank" href="https://www.odoo.com">Odoo</a>.</p> + </td> + </tr> + </tbody> + </table> + </div> + </template> </data> </odoo> |
