mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-23 02:12:07 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import crm_phonecall_to_phonecall
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
# Copyright 2004-2010 Tiny SPRL (<http://tiny.be>)
|
||||
# Copyright 2017 Tecnativa - Vicent Cubells
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import time
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class CrmPhonecall2phonecall(models.TransientModel):
|
||||
"""Added the details of the crm phonecall2phonecall."""
|
||||
|
||||
_name = "crm.phonecall2phonecall"
|
||||
_description = "Phonecall To Phonecall"
|
||||
|
||||
name = fields.Char(string="Call summary", required=True, index=True)
|
||||
user_id = fields.Many2one(comodel_name="res.users", string="Assign To")
|
||||
contact_name = fields.Char(string="Contact")
|
||||
phone = fields.Char()
|
||||
tag_ids = fields.Many2many(
|
||||
comodel_name="crm.tag",
|
||||
relation="crm_phonecall2phonecall_tag_rel",
|
||||
string="Tags",
|
||||
column1="phone_id",
|
||||
column2="tag_id",
|
||||
)
|
||||
date = fields.Datetime()
|
||||
team_id = fields.Many2one(comodel_name="crm.team", string="Sales Team")
|
||||
action = fields.Selection(
|
||||
selection=[("schedule", "Schedule a call"), ("log", "Log a call")],
|
||||
required=True,
|
||||
)
|
||||
partner_id = fields.Many2one(comodel_name="res.partner", string="Partner")
|
||||
note = fields.Text()
|
||||
|
||||
def get_vals_action_schedule(self):
|
||||
vals = {
|
||||
"schedule_time": self.date,
|
||||
"name": self.name,
|
||||
"user_id": self.user_id.id,
|
||||
"team_id": self.team_id.id or False,
|
||||
"tag_ids": self.tag_ids.ids,
|
||||
"action": self.action,
|
||||
}
|
||||
return vals
|
||||
|
||||
def action_schedule(self):
|
||||
"""Schedule a phonecall."""
|
||||
phonecall_obj = self.env["crm.phonecall"]
|
||||
phonecalls = phonecall_obj.browse(self._context.get("active_ids", []))
|
||||
vals = self.get_vals_action_schedule()
|
||||
new_phonecalls = phonecalls.schedule_another_phonecall(
|
||||
vals, return_recordset=True
|
||||
)
|
||||
return new_phonecalls.redirect_phonecall_view()
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
"""Function gets default values."""
|
||||
res = super().default_get(fields)
|
||||
res.update({"action": "schedule", "date": time.strftime("%Y-%m-%d %H:%M:%S")})
|
||||
for phonecall in self.env["crm.phonecall"].browse(
|
||||
self.env.context.get("active_id")
|
||||
):
|
||||
if "tag_ids" in fields:
|
||||
res.update({"tag_ids": phonecall.tag_ids.ids})
|
||||
if "user_id" in fields:
|
||||
res.update({"user_id": phonecall.user_id.id})
|
||||
if "team_id" in fields:
|
||||
res.update({"team_id": phonecall.team_id.id})
|
||||
if "partner_id" in fields:
|
||||
res.update({"partner_id": phonecall.partner_id.id})
|
||||
for field in ("name", "date"):
|
||||
if field in fields:
|
||||
res[field] = getattr(phonecall, field)
|
||||
return res
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="phonecall_to_phonecall_view" model="ir.ui.view">
|
||||
<field name="name">crm.phonecall2phonecall.form</field>
|
||||
<field name="model">crm.phonecall2phonecall</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Schedule/Log a Call">
|
||||
<group>
|
||||
<group>
|
||||
<field name="action" />
|
||||
<field attrs="{'readonly': [(1,'=',1)]}" name="partner_id" />
|
||||
<field groups="sales_team.group_sale_salesman" name="team_id" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field
|
||||
attrs="{'invisible': [('action','=','log')]}"
|
||||
name="date"
|
||||
string="Planned Date"
|
||||
/>
|
||||
<field
|
||||
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'sales_team.group_sale_salesman_all_leads']}"
|
||||
name="user_id"
|
||||
/>
|
||||
<field name="tag_ids" widget="many2many_tags" />
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
attrs="{'invisible' : [('action', '!=', 'log')]}"
|
||||
class="oe_highlight"
|
||||
name="action_schedule"
|
||||
string="Log Call"
|
||||
type="object"
|
||||
/>
|
||||
<button
|
||||
attrs="{'invisible' : [('action', '!=', 'schedule')]}"
|
||||
class="oe_highlight"
|
||||
name="action_schedule"
|
||||
string="Schedule Call"
|
||||
type="object"
|
||||
/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="phonecall_to_phonecall_act" model="ir.actions.act_window">
|
||||
<field name="name">Schedule Other Call</field>
|
||||
<field name="res_model">crm.phonecall2phonecall</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="phonecall_to_phonecall_view" />
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue