diff --git a/.~lock.opportunity.fodt# b/.~lock.opportunity.fodt# deleted file mode 100644 index b4e8548..0000000 --- a/.~lock.opportunity.fodt# +++ /dev/null @@ -1 +0,0 @@ -,dannybarajas,danny-Notebook,24.02.2022 22:14,file:///home/dannybarajas/.config/libreoffice/4; \ No newline at end of file diff --git a/.~lock.opportunity_only.fodt# b/.~lock.opportunity_only.fodt# deleted file mode 100644 index 6c1503f..0000000 --- a/.~lock.opportunity_only.fodt# +++ /dev/null @@ -1 +0,0 @@ -,dannybarajas,danny-Notebook,09.03.2022 16:38,file:///home/dannybarajas/.config/libreoffice/4; \ No newline at end of file diff --git a/__init__.py b/__init__.py index bdc610b..72d3c3b 100644 --- a/__init__.py +++ b/__init__.py @@ -10,9 +10,9 @@ from . import survey from . import activity from . import opportunity from . import party_validation -from . import exceptions from . import contract from . import ir +from . import company def register(): @@ -48,6 +48,7 @@ def register(): party_validation.OpportunityValidation, party_validation.ValidationHistoryAsk, contract.Contract, + company.Company, # opportunity.OpportunityEmployee, # opportunity.OpportunityEmployeeContext, # opportunity.OpportunityMonthly, diff --git a/company.py b/company.py new file mode 100644 index 0000000..ac25aed --- /dev/null +++ b/company.py @@ -0,0 +1,14 @@ +# This file is part of Tryton. The COPYRIGHT file at the top level of +# this repository contains the full copyright notices and license terms. +from trytond.model import fields +from trytond.pool import PoolMeta + + +class Company(metaclass=PoolMeta): + __name__ = 'company.company' + + cloudinary_name = fields.Char('Cloudinary Name') + cloudinary_api_key = fields.Char('Cloudinary Api Key') + cloudinary_api_secret = fields.Char('Cloudinary Api Secret') + cloudinary_upload_preset = fields.Char('Cloudinary Upload Preset') + cloudinary_upload_url = fields.Char('Cloudinary Upload Url') diff --git a/company.xml b/company.xml new file mode 100644 index 0000000..8ce0dfd --- /dev/null +++ b/company.xml @@ -0,0 +1,15 @@ + + + + + + + company.company + + + company_form + + + + \ No newline at end of file diff --git a/configuration.py b/configuration.py index 5a0b668..7d7e8a2 100644 --- a/configuration.py +++ b/configuration.py @@ -3,13 +3,13 @@ from trytond.model import ModelView, ModelSQL, fields from trytond.transaction import Transaction from trytond.pyson import Id -from trytond import backend from trytond.pyson import Eval -from trytond.pool import PoolMeta, Pool + class Configuration(ModelSQL, ModelView): 'CRM Configuration' __name__ = 'crm.configuration' + customer_service_sequence = fields.Many2One('ir.sequence', 'Customer Service Sequence', required=True, domain=[('sequence_type', '=', diff --git a/contract.py b/contract.py index 3ee36c3..9787eab 100644 --- a/contract.py +++ b/contract.py @@ -5,8 +5,9 @@ from trytond.model import fields class Contract(metaclass=PoolMeta): __name__ = 'sale.contract' - department = fields.Many2One('company.department','Department',states={'required':False}) + department = fields.Many2One('company.department', 'Department', states={'required': False}) + @classmethod def _get_origin(cls): 'Return list of Model names for origin Reference' - return super(Contract,cls)._get_origin() + ['crm.opportunity'] + return super(Contract, cls)._get_origin() + ['crm.opportunity'] diff --git a/customer_service.py b/customer_service.py index 4b2c288..0a45c47 100644 --- a/customer_service.py +++ b/customer_service.py @@ -7,7 +7,7 @@ from trytond.model import Workflow, ModelView, ModelSQL, fields from trytond.pyson import Eval, If, In, Get from trytond.transaction import Transaction from trytond.pool import Pool -from trytond.wizard import Wizard, StateView, Button, StateReport, StateTransition +from trytond.wizard import (Wizard, StateView, Button, StateReport, StateTransition) from trytond.report import Report from .exceptions import CustomerServiceError, CrmConfigurationError from trytond.i18n import gettext @@ -53,7 +53,6 @@ ETHNICAL_GROUP = [ ] - class CustomerService(Workflow, ModelSQL, ModelView): 'Customer Service' __name__ = 'crm.customer_service' @@ -61,10 +60,10 @@ class CustomerService(Workflow, ModelSQL, ModelView): number = fields.Char('Number', readonly=True) reference = fields.Char('Reference', states=STATES) party = fields.Many2One('party.party', 'Party', - states={ - 'readonly': (Eval('state') != 'draft'), - # 'required': (Eval('state') == 'open'), - }, select=True) + states={ + 'readonly': (Eval('state') != 'draft'), + # 'required': (Eval('state') == 'open'), + }, select=True) route = fields.Char('Route', states=STATES, select=True) customer = fields.Char('Customer', states=STATES, required=True, select=True) @@ -83,14 +82,14 @@ class CustomerService(Workflow, ModelSQL, ModelView): response = fields.Text('Response', states=STATES_CLOSE) cs_date = fields.DateTime('Date', states={'readonly': True}) effective_date = fields.DateTime('Effective Datetime', - states=STATES_CLOSE, depends=['state']) + states=STATES_CLOSE, depends=['state']) responsible_employee = fields.Many2One('company.employee', - 'Responsible', states=STATES_CLOSE) + 'Responsible', states=STATES_CLOSE) company = fields.Many2One('company.company', 'Company', required=True, - states=STATES, domain=[ - ('id', If(In('company', - Eval('context', {})), '=', '!='), Get(Eval('context', {}), - 'company', 0)), ]) + states=STATES, domain=[ + ('id', If(In('company', + Eval('context', {})), '=', '!='), Get(Eval('context', {}), + 'company', 0)), ]) satisfaction = fields.Selection(OPTION_SELECT, 'Satisfaction') satisfaction_string = satisfaction.translated('satisfaction') notes = fields.Text('Notes', states=STATES_CLOSE) diff --git a/opportunity.py b/opportunity.py index 7107cf9..011a5b6 100644 --- a/opportunity.py +++ b/opportunity.py @@ -23,8 +23,6 @@ from trytond.modules.company import CompanyReport # Manage errors from trytond.exceptions import UserError from .exceptions import IncompletePartyValidation, ChangeStateWarning -from trytond.exceptions import UserWarning - from trytond.ir.attachment import AttachmentCopyMixin from trytond.ir.note import NoteCopyMixin from trytond.modules.company.model import employee_field, set_employee diff --git a/tryton.cfg b/tryton.cfg index 75b6999..71b754c 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -17,3 +17,4 @@ xml: party_validation.xml opportunity.xml message.xml + company.xml diff --git a/view/company_form.xml b/view/company_form.xml new file mode 100644 index 0000000..7fa4e34 --- /dev/null +++ b/view/company_form.xml @@ -0,0 +1,19 @@ + + + + + + + +