-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7e62a9
commit 20ad3a4
Showing
8 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg | ||
:target: https://opensource.org/licenses/LGPL-3.0 | ||
:alt: License: LGPL-3 | ||
|
||
======================================================== | ||
CRM Last Dates | ||
======================================================== | ||
|
||
Overview | ||
======== | ||
|
||
The **CRM Last Dates** module adds the last lead, meeting, and invoice dates to the `res.partner` model. This enhancement provides valuable information for sales and account management by allowing users to easily track the most recent interactions and transactions with partners. | ||
|
||
Features | ||
======== | ||
|
||
- **Last Lead Date**: Displays the create date of the last lead associated with the partner. | ||
- **Last Meeting Date**: Shows the date of the most recent meeting related to the partner. | ||
- **Last Invoice Date**: Indicates the date of the latest invoice issued to the partner. | ||
|
||
Usage | ||
===== | ||
|
||
1. **Install the Module**: | ||
|
||
- Install the module through the Odoo apps interface or by placing it in your Odoo addons directory. | ||
|
||
2. **Access Partner Records**: | ||
|
||
- Navigate to **Contacts** > **Partners**. | ||
|
||
3. **View Last Dates**: | ||
|
||
- Open any partner record to view the new fields under the **Sales & Purchases** tab. | ||
|
||
Configuration | ||
============= | ||
|
||
- **User Permissions**: | ||
|
||
- Ensure that users have the necessary permissions to view partner records and related information. | ||
|
||
Testing | ||
======= | ||
|
||
Test the following scenarios: | ||
|
||
- **Field Visibility**: | ||
|
||
- Verify that the `Last Lead Date`, `Last Meeting Date`, and `Last Invoice Date` fields are correctly displayed in the partner form view. | ||
|
||
- **Data Accuracy**: | ||
|
||
- Ensure that the dates reflect the correct last lead, meeting, and invoice information for various partners. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
For bugs and issues, please visit `GitHub Issues <https://github.com/avanzosc/crm-addons/issues>`_ to report or track issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Unai Beristain <unaiberistain@avanzosc.es> | ||
|
||
* Ana Juaristi <anajuaristi@avanzosc.es> | ||
|
||
Please contact contributors for module-specific questions, but direct support requests should be made through the official channels. | ||
|
||
License | ||
======= | ||
This project is licensed under the LGPL-3 License. For more details, please refer to the LICENSE file or visit <https://opensource.org/licenses/LGPL-3.0>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "CRM Last Dates", | ||
"version": "14.0.1.0.0", | ||
"author": "Avanzosc", | ||
"summary": "Add last lead, meeting, and invoice dates to res.partner.", | ||
"website": "https://github.com/avanzosc/crm-addons", | ||
"license": "LGPL-3", | ||
"depends": ["crm", "calendar.event", "account "], | ||
"data": ["views/res_partner_view.xml"], | ||
"installable": True, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
last_lead_date = fields.Datetime( | ||
compute="_compute_last_dates", | ||
store=True, | ||
) | ||
last_meeting_date = fields.Datetime( | ||
compute="_compute_last_dates", | ||
store=True, | ||
) | ||
last_invoice_date = fields.Datetime( | ||
compute="_compute_last_dates", | ||
store=True, | ||
) | ||
|
||
@api.depends("commercial_partner_id") | ||
def _compute_last_dates(self): | ||
for partner in self: | ||
lead = self.env["crm.lead"].search( | ||
[("partner_id", "=", partner.commercial_partner_id.id)], | ||
order="create_date desc", | ||
limit=1, | ||
) | ||
partner.last_lead_date = lead.create_date if lead else False | ||
|
||
meeting = self.env["calendar.event"].search( | ||
[("partner_ids", "in", partner.commercial_partner_id.id)], | ||
order="create_date desc", | ||
limit=1, | ||
) | ||
partner.last_meeting_date = meeting.create_date if meeting else False | ||
|
||
invoice = self.env["account.move"].search( | ||
[ | ||
("partner_id", "=", partner.commercial_partner_id.id), | ||
("move_type", "=", "out_invoice"), | ||
], | ||
order="invoice_date desc", | ||
limit=1, | ||
) | ||
partner.last_invoice_date = invoice.invoice_date if invoice else False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_res_partner_form_inherit_last_dates" model="ir.ui.view"> | ||
<field name="name">res.partner.form.inherit.last.dates</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="base.view_partner_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[2]" position="inside"> | ||
<group string="Last Dates"> | ||
<field name="last_lead_date" /> | ||
<field name="last_meeting_date" /> | ||
<field name="last_invoice_date" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../crm_last_dates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |