This commit is contained in:
oscar alvarez 2023-11-24 16:23:36 -05:00
parent 3815fb34ff
commit fa641c85cc
10 changed files with 60 additions and 9 deletions

View File

@ -2,5 +2,7 @@ ALTER TABLE crm_opportunity_line RENAME time_ammount TO billing_frecuency;
ALTER TABLE crm_opportunity DROP COLUMN source;
ALTER TABLE crm_configuration DROP COLUMN activity_sequence;
ALTER TABLE crm_configuration DROP COLUMN crm_activity_sequence;
DROP TABLE crm_activity;
DROP TABLE crm_opportunity_follow_up;

View File

@ -35,7 +35,7 @@ def register():
opportunity.Opportunity,
opportunity.LeadOrigin,
opportunity.CrmOpportunityLine,
# opportunity.CrmOpportunityFollowUp,
# opportunity.Person,
opportunity.OpportunityCancellReason,
opportunity.OpportunitySaleConditions,
ir.Cron,

View File

@ -13,18 +13,18 @@ class Activity(Workflow, ModelSQL, ModelView):
'CRM Activity'
__name__ = 'crm.activity'
_rec_name = 'subject'
_READONLY = {'readonly': Eval('state') == 'done'}
opportunity = fields.Many2One('crm.opportunity', 'Opportunity',
required=True, readonly=True)
subject = fields.Char('Subject', states={
'readonly': (Eval('state') == 'done'),
})
subject = fields.Char('Subject', states=_READONLY)
type_= fields.Selection([
('action', 'Action'),
('call', 'Call'),
('on_site_appointment', 'On-Site Appointment'),
('virtual_appointment', 'Virtual Appointment'),
('chat', 'Chat'),
('email', 'Email'),
], 'Type', states=STATES, depends=['state'], required=True)
], 'Type', depends=['state'], states=_READONLY)
type_info = fields.Char('Type Info', states=STATES)
planned_date = fields.Date('Planned Date', states=STATES, required=True)
planned_time = fields.Time('Planned Time', states=STATES)

View File

@ -37,6 +37,17 @@ class Prospect(ModelSQL, ModelView):
agent = fields.Many2One('commission.agent', 'Agent')
class Person(ModelSQL, ModelView):
'Person'
__name__ = 'crm.person'
opportunity = fields.Many2One('crm.opportunity', 'Opportunity',
required=True, readonly=True)
name = fields.Char("Name", required=True)
phone = fields.Char('Contact Phone')
email = fields.Char('Email')
id_number = fields.Char('Id Number')
class Opportunity(
Workflow, ModelSQL, ModelView,
AttachmentCopyMixin, NoteCopyMixin):
@ -58,8 +69,9 @@ class Opportunity(
}
_depends_stop = ['state']
number = fields.Char('Number', readonly=True, required=True)
prospect = fields.Many2One('crm.prospect', 'Prospect', required=True)
party_contact = fields.Char('Party Contact', states=_states_opp)
prospect = fields.Many2One('crm.prospect', 'Prospect', required=True,
states=_states_opp)
party_contact = fields.Char('Party Contact', readonly=True)
contact_phone = fields.Char('Contact Phone', states=_states_opp)
contact_email = fields.Char('Email')
reference = fields.Char('Reference', states=_states_opp)
@ -184,6 +196,10 @@ class Opportunity(
states={
'invisible': ~Eval('state').in_(['won'])
}, depends=['state'])
persons = fields.One2Many('crm.person', 'opportunity', 'Persons',
states={
'readonly': Eval('state').in_(['won', 'lost']),
})
@classmethod
def __setup__(cls):

View File

@ -315,5 +315,17 @@ this repository contains the full copyright notices and license terms. -->
<menuitem name="Lead Origin" parent="crm.menu_crm_configuration"
id="menu_crm_lead_origin" sequence="70"
action="act_lead_origin_form" />
<record model="ir.ui.view" id="crm_person_view_form">
<field name="model">crm.person</field>
<field name="type">form</field>
<field name="name">person_form</field>
</record>
<record model="ir.ui.view" id="crm_person_view_tree">
<field name="model">crm.person</field>
<field name="type">tree</field>
<field name="name">person_tree</field>
</record>
</data>
</tryton>

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.17
version=6.0.18
depends:
party
sale

View File

@ -5,6 +5,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="company" expand="1"/>
<field name="customer_service_sequence" expand="1"/>
<field name="survey_sequence" expand="1"/>
<field name="activity_sequence" expand="1"/>
<field name="opportunity_sequence" expand="1"/>
</tree>

View File

@ -60,6 +60,9 @@ this repository contains the full copyright notices and license terms. -->
<page name="sales">
<field name="sales" colspan="4"/>
</page>
<!-- <page name="persons">
<field name="persons" colspan="4"/>
</page> -->
<!-- <page string="Contracts" name="contracts">
<field name="contracts" colspan="4"/>
</page> -->

11
view/person_form.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form>
<label name="name"/>
<field name="name"/>
<label name="phone"/>
<field name="phone"/>
<label name="email"/>
<field name="email"/>
</form>

8
view/person_tree.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="name" expand="1"/>
<field name="phone" expand="1"/>
<field name="email" expand="1"/>
</tree>