-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
19 changed files
with
929 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,96 @@ | ||
============================ | ||
Crm Salesperson Planner Sale | ||
============================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:c9fb35c0e00b295b492cd7e894041986aa3304d7ec4a1affe6042381193bf329 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github | ||
:target: https://github.com/OCA/crm/tree/16.0/crm_salesperson_planner_sale | ||
:alt: OCA/crm | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_salesperson_planner_sale | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows you to manage sales from commercial visits. | ||
You can create Sales Quotations from visits and check the related ones. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
* Go to any "Validated" or "Visited" visit. | ||
* Click "New Quotation" button or click in the smart button "Quotation" and create a quotation. | ||
|
||
In the Quotation or Sale Order you will have a new field that is related to the salesperson visit. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_salesperson_planner_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Sygel Technology | ||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Sygel <https://www.sygel.es>`__: | ||
|
||
* Valentin Vinagre | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Víctor Martínez | ||
|
||
* `Pesol <https://www.pesol.es>`__: | ||
|
||
* Gerardo Marin Parra <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/16.0/crm_salesperson_planner_sale>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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,4 @@ | ||
# Copyright 2021 Sygel - Valentin Vinagre | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
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,17 @@ | ||
# Copyright 2021 Sygel - Valentin Vinagre | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
{ | ||
"name": "Crm Salesperson Planner Sale", | ||
"version": "16.0.1.0.0", | ||
"development_status": "Beta", | ||
"category": "Customer Relationship Management", | ||
"author": "Sygel Technology, Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/crm", | ||
"license": "AGPL-3", | ||
"depends": ["crm_salesperson_planner", "sale"], | ||
"data": [ | ||
"views/sale_order_views.xml", | ||
"views/crm_salesperson_planner_visit_views.xml", | ||
], | ||
"installable": True, | ||
} |
60 changes: 60 additions & 0 deletions
60
crm_salesperson_planner_sale/i18n/crm_salesperson_planner_sale.pot
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,60 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * crm_salesperson_planner_sale | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "New Quotation" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__quotation_count | ||
msgid "Number of Quotations" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__sale_order_count | ||
msgid "Number of Sale Orders" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__order_ids | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "Orders" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.actions.act_window,name:crm_salesperson_planner_sale.crm_salesperson_visit_action_quotation_new | ||
msgid "Quotation" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "Quotations" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model,name:crm_salesperson_planner_sale.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model,name:crm_salesperson_planner_sale.model_crm_salesperson_planner_visit | ||
msgid "Salesperson Planner Visit" | ||
msgstr "" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_sale_order__visit_id | ||
msgid "Visit" | ||
msgstr "" |
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,64 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * crm_salesperson_planner_sale | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-11-30 13:07+0000\n" | ||
"PO-Revision-Date: 2022-11-30 14:07+0100\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"X-Generator: Poedit 3.0.1\n" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "New Quotation" | ||
msgstr "Nuevo presupuesto" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__quotation_count | ||
msgid "Number of Quotations" | ||
msgstr "Nº de presupuestos" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__sale_order_count | ||
msgid "Number of Sale Orders" | ||
msgstr "Nº de ordenes de venta" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_crm_salesperson_planner_visit__order_ids | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "Orders" | ||
msgstr "Ventas" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.actions.act_window,name:crm_salesperson_planner_sale.crm_salesperson_visit_action_quotation_new | ||
msgid "Quotation" | ||
msgstr "Presupuesto" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model_terms:ir.ui.view,arch_db:crm_salesperson_planner_sale.crm_salesperson_planner_visit_sale_form_view | ||
msgid "Quotations" | ||
msgstr "Presupuestos" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model,name:crm_salesperson_planner_sale.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "Pedido de venta" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model,name:crm_salesperson_planner_sale.model_crm_salesperson_planner_visit | ||
msgid "Salesperson Planner Visit" | ||
msgstr "Planificador de visitas comerciales" | ||
|
||
#. module: crm_salesperson_planner_sale | ||
#: model:ir.model.fields,field_description:crm_salesperson_planner_sale.field_sale_order__visit_id | ||
msgid "Visit" | ||
msgstr "Visita" |
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,5 @@ | ||
# Copyright 2021 Sygel - Valentin Vinagre | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
from . import sale_order | ||
from . import crm_salesperson_planner_visit |
90 changes: 90 additions & 0 deletions
90
crm_salesperson_planner_sale/models/crm_salesperson_planner_visit.py
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,90 @@ | ||
# Copyright 2021 Sygel - Valentin Vinagre | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class CrmSalespersonPlannerVisit(models.Model): | ||
_inherit = "crm.salesperson.planner.visit" | ||
|
||
order_ids = fields.One2many("sale.order", "visit_id", string="Orders") | ||
sale_order_count = fields.Integer( | ||
compute="_compute_sale_data", string="Number of Sale Orders", store=True | ||
) | ||
quotation_count = fields.Integer( | ||
compute="_compute_sale_data", string="Number of Quotations", store=True | ||
) | ||
|
||
@api.depends("order_ids.state") | ||
def _compute_sale_data(self): | ||
quotation_domain = [ | ||
("visit_id", "in", self.ids), | ||
("state", "in", ("draft", "sent")), | ||
] | ||
quotation_data = self.env["sale.order"].read_group( | ||
domain=quotation_domain, fields=["visit_id"], groupby=["visit_id"] | ||
) | ||
sale_domain = [ | ||
("visit_id", "in", self.ids), | ||
("state", "not in", ("draft", "sent", "cancel")), | ||
] | ||
sale_data = self.env["sale.order"].read_group( | ||
domain=sale_domain, fields=["visit_id"], groupby=["visit_id"] | ||
) | ||
mapped_quotation_data = { | ||
m["visit_id"][0]: m["visit_id_count"] for m in quotation_data | ||
} | ||
mapped_sale_data = {m["visit_id"][0]: m["visit_id_count"] for m in sale_data} | ||
for sel in self: | ||
sel.quotation_count = mapped_quotation_data.get(sel.id, 0) | ||
sel.sale_order_count = mapped_sale_data.get(sel.id, 0) | ||
|
||
def _prepare_context_from_action(self): | ||
return { | ||
"search_default_visit_id": self.id, | ||
"default_visit_id": self.id, | ||
"search_default_partner_id": self.partner_id.commercial_partner_id.id, | ||
"default_partner_id": self.partner_id.commercial_partner_id.id, | ||
"default_origin": self.name, | ||
"default_company_id": self.company_id.id or self.env.company.id, | ||
"default_user_id": self.user_id.id, | ||
} | ||
|
||
def action_sale_quotation_new(self): | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"crm_salesperson_planner_sale.crm_salesperson_visit_action_quotation_new" | ||
) | ||
action["context"] = self._prepare_context_from_action() | ||
return action | ||
|
||
def action_view_sale_quotation(self): | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"sale.action_quotations_with_onboarding" | ||
) | ||
ctx = self._prepare_context_from_action() | ||
ctx.update(search_default_draft=1) | ||
action["context"] = ctx | ||
action["domain"] = [ | ||
("visit_id", "=", self.id), | ||
("state", "in", ("draft", "sent")), | ||
] | ||
if self.quotation_count == 1: | ||
action["views"] = [(self.env.ref("sale.view_order_form").id, "form")] | ||
quotation = self.order_ids.filtered(lambda l: l.state in ("draft", "sent")) | ||
action["res_id"] = quotation.id | ||
return action | ||
|
||
def action_view_sale_order(self): | ||
action = self.env["ir.actions.act_window"]._for_xml_id("sale.action_orders") | ||
action["context"] = self._prepare_context_from_action() | ||
action["domain"] = [ | ||
("visit_id", "=", self.id), | ||
("state", "not in", ("draft", "sent", "cancel")), | ||
] | ||
if self.sale_order_count == 1: | ||
action["views"] = [(self.env.ref("sale.view_order_form").id, "form")] | ||
order = self.order_ids.filtered( | ||
lambda l: l.state not in ("draft", "sent", "cancel") | ||
) | ||
action["res_id"] = order.id | ||
return action |
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,16 @@ | ||
# Copyright 2021 Sygel - Valentin Vinagre | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
visit_id = fields.Many2one( | ||
comodel_name="crm.salesperson.planner.visit", | ||
string="Visit", | ||
check_company=True, | ||
domain="[('partner_id', 'child_of', partner_id)," | ||
" '|', ('company_id', '=', False), ('company_id', '=', company_id)]", | ||
) |
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,11 @@ | ||
* `Sygel <https://www.sygel.es>`__: | ||
|
||
* Valentin Vinagre | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Víctor Martínez | ||
|
||
* `Pesol <https://www.pesol.es>`__: | ||
|
||
* Gerardo Marin Parra <[email protected]> |
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,2 @@ | ||
This module allows you to manage sales from commercial visits. | ||
You can create Sales Quotations from visits and check the related ones. |
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,4 @@ | ||
* Go to any "Validated" or "Visited" visit. | ||
* Click "New Quotation" button or click in the smart button "Quotation" and create a quotation. | ||
|
||
In the Quotation or Sale Order you will have a new field that is related to the salesperson visit. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.