[MRG] merge with lp:~openerp-dev/openobject-addons/trunk-v62_config_sale-uco

bzr revid: tpa@tinyerp.com-20120229092807-42p9jo4c77zphd7d
bzr revid: tpa@tinyerp.com-20120229100510-wqyrbiblzix57zdj
This commit is contained in:
Turkesh Patel (Open ERP)
2012-02-29 15:35:10 +05:30
22 changed files with 829 additions and 286 deletions
+1
View File
@@ -37,4 +37,5 @@ import ir_sequence
import company
import res_currency
import edi
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+47
View File
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class account_configuration(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'tax_policy': fields.selection([
('no_tax', 'No Tax'),
('global_on_order', 'Global On Order'),
('on_order_line', 'On Order Lines'),
], 'Taxes', required=True),
'tax_value': fields.float('Value'),
}
_defaults = {
'tax_policy': 'global_on_order',
'tax_value': 15.0,
}
def get_tax_value(self, cr, uid, ids, context=None):
result = {}
chart_account_obj = self.pool.get('wizard.multi.charts.accounts')
chart_account_obj.execute(cr, uid, ids, context=context)
return result
account_configuration()
+8
View File
@@ -0,0 +1,8 @@
class account_configuration(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'tax_value' : fields.many2one('account.tax', 'Value'),
}
account_configuration()
+1
View File
@@ -28,6 +28,7 @@ import crm_phonecall
import report
import wizard
import res_partner
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2
View File
@@ -111,6 +111,8 @@ Creates a dashboard for CRM that includes:
'res_partner_view.xml',
'board_crm_statistical_view.xml',
'board_crm_view.xml',
'res_config_view.xml',
],
'demo_xml': [
+96
View File
@@ -0,0 +1,96 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class crm_configuration(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'crm_caldav' : fields.boolean("Use caldav to synchronize Meetings",
help="Install crm_caldav module: Caldav features in Meeting"),
'fetchmail_crm': fields.boolean("Lead/Opportunity mail gateway"),
'server' : fields.char('Server Name', size=256),
'port' : fields.integer('Port'),
'type': fields.selection([
('pop', 'POP Server'),
('imap', 'IMAP Server'),
('local', 'Local Server'),
], 'Server Type'),
'is_ssl': fields.boolean('SSL/TLS', help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP=995)"),
'user' : fields.char('Username', size=256),
'password' : fields.char('Password', size=1024),
}
_defaults = {
'type': 'pop',
}
def get_default_email_configurations(self, cr, uid, ids, context=None):
ir_values_obj = self.pool.get('ir.values')
result = {}
installed_modules = self.get_default_installed_modules(cr, uid, ids, context=context)
if 'fetchmail_crm' in installed_modules.keys():
for val in ir_values_obj.get(cr, uid, 'default', False, ['fetchmail.server']):
result.update({val[1]: val[2]})
return result
def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False):
port = 0
values = {}
if server_type == 'pop':
port = ssl and 995 or 110
elif server_type == 'imap':
port = ssl and 993 or 143
else:
values['server'] = ''
values['port'] = port
return {'value': values}
def set_email_configurations(self, cr, uid, ids, vals, context=None):
model_obj = self.pool.get('ir.model')
fetchmail_obj = self.pool.get('fetchmail.server')
ir_values_obj = self.pool.get('ir.values')
if vals.get('fetchmail_crm'):
object_id = model_obj.search(cr, uid, [('model','=','crm.lead')])[0]
fetchmail_vals = {
'name': 'Incoming Leads',
'object_id': object_id,
'server': vals.get('server'),
'port': vals.get('port'),
'is_ssl': vals.get('is_ssl'),
'type': vals.get('type'),
'user': vals.get('user'),
'password': vals.get('password')
}
if not self.get_installed_modules(cr, uid, ['fetchmail_crm'], context):
fetchmail_obj.create(cr, uid, fetchmail_vals, context=context)
else:
fetchmail_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Leads')], context=context)
fetchmail_obj.write(cr, uid, fetchmail_ids, fetchmail_vals, context=context)
ir_values_obj.set(cr, uid, 'default', False, 'server', ['fetchmail.server'], fetchmail_vals.get('server'))
ir_values_obj.set(cr, uid, 'default', False, 'port', ['fetchmail.server'], fetchmail_vals.get('port'))
ir_values_obj.set(cr, uid, 'default', False, 'is_ssl', ['fetchmail.server'], fetchmail_vals.get('is_ssl'))
ir_values_obj.set(cr, uid, 'default', False, 'type', ['fetchmail.server'], fetchmail_vals.get('type'))
ir_values_obj.set(cr, uid, 'default', False, 'user', ['fetchmail.server'], fetchmail_vals.get('user'))
ir_values_obj.set(cr, uid, 'default', False, 'password', ['fetchmail.server'], fetchmail_vals.get('password'))
crm_configuration()
+36
View File
@@ -0,0 +1,36 @@
<openerp>
<data>
<record id="view_sales_config_crm" model="ir.ui.view">
<field name="name">Sales Application</field>
<field name="model">res.config</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<xpath expr="//form/group[@name='emails']" position="inside">
<group col="2" colspan="2">
<separator string="Emails" colspan="4"/>
<field name="fetchmail_crm" colspan="2"/>
<newline/>
<group col="4" colspan="4"
attrs="{'invisible': [('fetchmail_crm','=',False)]}">
<field name="server" attrs="{'required': [('fetchmail_crm','=',True)]}"/>
<field name="type" nolabel="1" on_change="onchange_server_type(type, is_ssl)" attrs="{'required': [('fetchmail_crm','=',True)]}"/>
<field name="port" attrs="{'required': [('fetchmail_crm','=',True)]}"/>
<field name="is_ssl" on_change="onchange_server_type(type, is_ssl)"/>
<newline/>
<field name="user" attrs="{'required': [('fetchmail_crm','=',True)]}"/>
<field name="password" attrs="{'required': [('fetchmail_crm','=',True)]}"/>
</group>
</group>
</xpath>
<xpath expr="//form/group[@name='synchronization']" position="inside">
<group colspan="2" col="2">
<field name="crm_caldav"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
+1 -1
View File
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-02-28 05:47+0000\n"
"X-Launchpad-Export-Date: 2012-02-29 04:42+0000\n"
"X-Generator: Launchpad (build 14874)\n"
#. module: hr
+226
View File
@@ -0,0 +1,226 @@
# Dutch translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-08 00:36+0000\n"
"PO-Revision-Date: 2012-02-28 17:29+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Dutch <nl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-02-29 04:42+0000\n"
"X-Generator: Launchpad (build 14874)\n"
#. module: import_google
#: help:synchronize.google.import,group_name:0
msgid "Choose which group to import, By default it takes all."
msgstr ""
"Kies welke groep moet worden geïmporteerd. Standaard worden alle geroepen "
"genomen"
#. module: import_google
#: view:synchronize.google.import:0
msgid "Import Google Calendar Events"
msgstr "Importeer Google agenda afspraken"
#. module: import_google
#: view:synchronize.google.import:0
msgid "_Import Events"
msgstr "_Importeer afspraken"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:71
#, python-format
msgid ""
"No Google Username or password Defined for user.\n"
"Please define in user view"
msgstr ""
"Geen Google gebruikersnaam of wachtwoord gedefinieerd bij de gebruiker.\n"
"Definieer deze in de gebruikersweergave"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:127
#, python-format
msgid ""
"Invalid login detail !\n"
" Specify Username/Password."
msgstr ""
"Ongeldige login detail!\n"
" Specificeer gebruikersnaam en wachtwoord."
#. module: import_google
#: field:synchronize.google.import,supplier:0
msgid "Supplier"
msgstr "Leverancier"
#. module: import_google
#: view:synchronize.google.import:0
msgid "Import Options"
msgstr "Importeeropties"
#. module: import_google
#: field:synchronize.google.import,group_name:0
msgid "Group Name"
msgstr "Groepsnaam"
#. module: import_google
#: model:ir.model,name:import_google.model_crm_case_categ
msgid "Category of Case"
msgstr "Dossiercategorie"
#. module: import_google
#: model:ir.actions.act_window,name:import_google.act_google_login_contact_form
#: model:ir.ui.menu,name:import_google.menu_sync_contact
msgid "Import Google Contacts"
msgstr "Importeer Google contacten"
#. module: import_google
#: view:google.import.message:0
msgid "Import Google Data"
msgstr "Importeer Google gegevens"
#. module: import_google
#: view:crm.meeting:0
msgid "Meeting Type"
msgstr "Soort afspraak"
#. module: import_google
#: code:addons/import_google/wizard/import_google.py:38
#: code:addons/import_google/wizard/import_google_data.py:28
#, python-format
msgid ""
"Please install gdata-python-client from http://code.google.com/p/gdata-"
"python-client/downloads/list"
msgstr ""
"Installeer a.u.b. gdata-python-client from http://code.google.com/p/gdata-"
"python-client/downloads/list"
#. module: import_google
#: model:ir.model,name:import_google.model_google_login
msgid "Google Contact"
msgstr "Google Contactpersoon"
#. module: import_google
#: view:synchronize.google.import:0
msgid "Import contacts from a google account"
msgstr "Importeer contacten van een Google account"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:133
#, python-format
msgid "Please specify correct user and password !"
msgstr "Geef alstublieft een juiste gebruikersnaam en wachtwoord op!"
#. module: import_google
#: field:synchronize.google.import,customer:0
msgid "Customer"
msgstr "Klant"
#. module: import_google
#: view:synchronize.google.import:0
msgid "_Cancel"
msgstr "_Annuleren"
#. module: import_google
#: model:ir.model,name:import_google.model_synchronize_google_import
msgid "synchronize.google.import"
msgstr "synchronize.google.import"
#. module: import_google
#: view:synchronize.google.import:0
msgid "_Import Contacts"
msgstr "_Importeer contacten"
#. module: import_google
#: model:ir.actions.act_window,name:import_google.act_google_login_form
#: model:ir.ui.menu,name:import_google.menu_sync_calendar
msgid "Import Google Calendar"
msgstr "Importeer Google agenda"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:50
#, python-format
msgid "Import google"
msgstr "Importeer Google"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:127
#: code:addons/import_google/wizard/import_google_data.py:133
#, python-format
msgid "Error"
msgstr "Fout"
#. module: import_google
#: code:addons/import_google/wizard/import_google_data.py:71
#, python-format
msgid "Warning !"
msgstr "Waarschuwing !"
#. module: import_google
#: field:synchronize.google.import,create_partner:0
msgid "Options"
msgstr "Opties"
#. module: import_google
#: view:google.import.message:0
msgid "_Ok"
msgstr "_Ok"
#. module: import_google
#: code:addons/import_google/wizard/import_google.py:38
#: code:addons/import_google/wizard/import_google_data.py:28
#, python-format
msgid "Google Contacts Import Error!"
msgstr "Google contactpersonen import fout!"
#. module: import_google
#: model:ir.model,name:import_google.model_google_import_message
msgid "Import Message"
msgstr "Bericht importeren"
#. module: import_google
#: field:synchronize.google.import,calendar_name:0
msgid "Calendar Name"
msgstr "Agendanaam"
#. module: import_google
#: help:synchronize.google.import,supplier:0
msgid "Check this box to set newly created partner as Supplier."
msgstr ""
"Vink deze optie aan om van de nieuwe relatie een leverancier te maken"
#. module: import_google
#: selection:synchronize.google.import,create_partner:0
msgid "Import only address"
msgstr "Importeer alleen adres"
#. module: import_google
#: field:crm.case.categ,user_id:0
msgid "User"
msgstr "Gebruiker"
#. module: import_google
#: view:synchronize.google.import:0
msgid "Partner status for this group:"
msgstr "Relatiestatus voor deze groep"
#. module: import_google
#: field:google.import.message,name:0
msgid "Message"
msgstr "Bericht"
#. module: import_google
#: selection:synchronize.google.import,create_partner:0
msgid "Create partner for each contact"
msgstr "Maak relatie van ieder contact"
#. module: import_google
#: help:synchronize.google.import,customer:0
msgid "Check this box to set newly created partner as Customer."
msgstr "Vink deze optie aan om van de nieuwe relatie een klant te maken"
+3 -3
View File
@@ -48,9 +48,9 @@
<field name="target">new</field>
</record>
<record id="view_config_outlook_installer" model="ir.ui.view">
<!--record id="view_config_outlook_installer" model="ir.ui.view">
<field name="name">Sales Application</field>
<field name="model">sale.configuration</field>
<field name="model">res.config</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_config_picking_policy"/>
<field name="arch" type="xml">
@@ -58,7 +58,7 @@
<button name="%(action_outlook_installer)d" type="action" string="Configure Outlook Plug-In" icon="gtk-execute" colspan="2"/>
</field>
</field>
</record>
</record-->
<record id="action_outlook_wizard" model="ir.actions.act_window">
<field name="name">Install Outlook Plug-In</field>
@@ -55,9 +55,9 @@
<field name="target">new</field>
</record>
<record id="view_config_thunderbird_installer" model="ir.ui.view">
<!--record id="view_config_thunderbird_installer" model="ir.ui.view">
<field name="name">Sales Application</field>
<field name="model">sale.configuration</field>
<field name="model">res.config</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_config_picking_policy"/>
<field name="arch" type="xml">
@@ -65,7 +65,7 @@
<button name="%(action_thunderbird_installer)d" type="action" string="Configure Thunderbird Plug-In" icon="gtk-execute" colspan="2"/>
</field>
</field>
</record>
</record-->
<menuitem id="base.menu_base_config_plugins" name="Plugins" parent="base.menu_base_config" sequence="10"/>
<menuitem id="menu_base_config_plugins_thunderbird" action="action_thunderbird_installer" parent="base.menu_base_config_plugins" sequence="10"/>
+1
View File
@@ -23,5 +23,6 @@ import pricelist
import report
import partner
import wizard
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+32
View File
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class product_groups_configuration(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'group_sale_pricelist_per_customer':fields.boolean("Pricelist per customer ",help="Group to Activate pricelist to manage prices per customer"),
'group_sale_uom_per_product':fields.boolean("UOM per product",help="Group to Allow different unit of measure per product"),
}
product_groups_configuration()
@@ -18,6 +18,21 @@
<field name="name">Product Variant</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_pricelist_per_customer" model="res.groups">
<field name="name">Sales Pricelists</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_uom_per_product" model="res.groups">
<field name="name">Product UOM</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(6,0,[ref('base.group_sale_pricelist_per_customer'),
ref('base.group_sale_uom_per_product')])]"/>
</record>
<record model="ir.rule" id="product_pricelist_comp_rule">
<field name="name">product pricelist company rule</field>
+1
View File
@@ -29,5 +29,6 @@ import wizard
import report
import company
import edi
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1
View File
@@ -85,6 +85,7 @@ Dashboard for Sales Manager that includes:
'process/sale_process.xml',
'board_sale_view.xml',
'edi/sale_order_action_data.xml',
'res_config_view.xml',
],
'demo_xml': ['sale_demo.xml'],
'test': [
+218
View File
@@ -0,0 +1,218 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
import pooler
from tools.translate import _
MODULE_LIST = [
'analytic_user_function', 'analytic_journal_billing_rate', 'import_sugarcrm',
'import_google', 'crm_caldav', 'wiki_sale_faq', 'base_contact','sale_layout','warning',
'google_map', 'fetchmail_crm', 'plugin_thunderbird', 'plugin_outlook','account_analytic_analysis',
'project_timesheet', 'account_analytic_analysis', 'project_mrp', 'delivery',
'sale_margin', 'sale_journal'
]
class sale_configuration(osv.osv_memory):
_inherit = 'res.config'
_columns = {
'sale_orders': fields.boolean('Based on Sales Orders',),
'deli_orders': fields.boolean('Based on Delivery Orders'),
'task_work': fields.boolean('Based on Tasks\' Work'),
'timesheet': fields.boolean('Based on Timesheet'),
'order_policy': fields.selection([
('manual', 'Invoice Based on Sales Orders'),
('picking', 'Invoice Based on Deliveries'),
], 'Main Method Based On', required=True, help="You can generate invoices based on sales orders or based on shippings."),
'charge_delivery': fields.boolean('Do you charge the delivery?'),
'time_unit': fields.many2one('product.uom','Working Time Unit'),
'picking_policy' : fields.boolean("Deliver all products at once?"),
'group_sale_delivery_address':fields.boolean("Multiple Address",help="Group To Allow delivery address different from invoice address"),
'group_sale_disc_per_sale_order_line':fields.boolean("Discounts per sale order lines ",help="Group to apply discounts per sale order lines"),
'sale_layout':fields.boolean("Notes & subtotals per line",help="Install sale_layout module: This module provides features to improve the layout of the Sales Order.."),
'warning': fields.boolean("Alerts by products or customers",
help="Install warning module: Module to trigger warnings in OpenERP objects."),
'sale_margin': fields.boolean("Display Margin For Users",
help="Install sale_margin module: This module adds the 'Margin' on sales order."),
'sale_journal': fields.boolean("Invoice journal?",
help="Install sale_journal module: The sales journal modules allows you to categorise your sales and deliveries (picking lists) between different journals."),
'analytic_user_function' : fields.boolean("User function by contracts",
help="Install analytic_user_function module:This module allows you to define what is the default function of a specific user on a given account"),
'analytic_journal_billing_rate' : fields.boolean("Billing rates by contracts",
help="Install analytic_journal_billing_rate module: This module allows you to define what is the default invoicing rate for a specific journal on a given account."),
'import_sugarcrm' : fields.boolean("Import data from sugarCRM?",
help="Install import_sugarcrm module: This Module Import SugarCRM Leads, Opportunities, Users, Accounts, Contacts, Employees, Meetings, Phonecalls, Emails, and Project, Project Tasks Data into OpenERP Module."),
'import_google' : fields.boolean("Import Contacts & Meetings from Google",
help="Install import_google module: The module adds google contact in partner address and add google calendar events details in Meeting"),
'wiki_sale_faq' : fields.boolean("Install a sales FAQ?",
help="Install wiki_sale_faq module: This module provides a Wiki Sales FAQ Template."),
'base_contact' : fields.boolean("Manage a several address per customer",
help="Install crm_partner_assign module: This is the module used by OpenERP SA to redirect customers to its partners, based on geolocalization."),
'google_map' : fields.boolean("Google maps on customer",
help="Install google_map module: The module adds Google Map field in partner address."),
'plugin_thunderbird': fields.boolean('Thunderbird plugin',
help="Install plugin_thunderbird module: This module is required for the Thuderbird Plug-in to work properly."),
'plugin_outlook': fields.boolean('Outlook plugin',
help="Install plugin_outlook module: This module provides the Outlook Plug-in."),
'account_analytic_analysis': fields.boolean('Contracts',
help="Install account_analytic_analysis module: This module is for modifying account analytic view to show important data to project manager of services companies."),
}
def get_default_applied_groups(self, cr, uid, ids, context=None):
applied_groups = {}
user_obj = self.pool.get('res.users')
dataobj = self.pool.get('ir.model.data')
groups = []
user_group_ids = user_obj.browse(cr, uid, uid, context=context).groups_id
for group_id in user_group_ids:
groups.append(group_id.id)
for id in groups:
key_id = dataobj.search(cr, uid,[('res_id','=',id),('model','=','res.groups')],context=context)
key = dataobj.browse(cr, uid, key_id[0], context=context).name
applied_groups[key] = True
return applied_groups
def get_default_installed_modules(self, cr, uid, ids, context=None):
module_obj = self.pool.get('ir.module.module')
module_ids = module_obj.search(cr, uid,
[('name','in',MODULE_LIST),
('state','in',['to install', 'installed', 'to upgrade'])],
context=context)
installed_modules = dict([(mod.name,True) for mod in module_obj.browse(cr, uid, module_ids, context=context)])
return installed_modules
def get_default_sale_configs(self, cr, uid, ids, context=None):
ir_values_obj = self.pool.get('ir.values')
result = {}
defaults = ir_values_obj.get(cr, uid, 'default', False, ['sale.order'])
return result
def get_default_groups(self, cr, uid, ids, context=None):
ir_values_obj = self.pool.get('ir.values')
result = {}
defaults = ir_values_obj.get(cr, uid, 'default', False, ['res.users'])
return result
def default_get(self, cr, uid, fields_list, context=None):
result = super(sale_configuration, self).default_get(
cr, uid, fields_list, context=context)
for method in dir(self):
if method.startswith('get_default_'):
result.update(getattr(self, method)(cr, uid, [], context))
return result
_defaults = {
'order_policy': 'manual',
'time_unit': lambda self, cr, uid, c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c) and self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c)[0] or False,
}
def create(self, cr, uid, vals, context=None):
ids = super(sale_configuration, self).create(cr, uid, vals, context=context)
self.execute(cr, uid, [ids], vals, context=context)
return ids
def write(self, cr, uid, ids, vals, context=None):
self.execute(cr, uid, ids, vals, context=context)
return super(sale_configuration, self).write(cr, uid, ids, vals, context=context)
def execute(self, cr, uid, ids, vals, context=None):
#TODO: TO BE IMPLEMENTED
for method in dir(self):
if method.startswith('set_'):
getattr(self, method)(cr, uid, ids, vals, context)
return True
def set_modules(self, cr, uid, ids, vals, context=None):
module_obj = self.pool.get('ir.module.module')
for k, v in vals.items():
if k in MODULE_LIST:
installed = self.get_default_installed_modules(cr, uid, [k], context)
if v == True and not installed:
module_id = module_obj.search(cr, uid, [('name','=',k)])[0]
module_obj.state_update(cr, uid, [module_id], 'to install', ['uninstalled'], context)
cr.commit()
pooler.restart_pool(cr.dbname, update_module=True)[1]
elif v == False and installed.get(k):
module_id = module_obj.search(cr, uid, [('name','=',k)])[0]
module_obj.state_update(cr, uid, [module_id], 'to remove', ['installed'], context)
cr.commit()
pooler.restart_pool(cr.dbname, update_module=True)[1]
def set_sale_defaults(self, cr, uid, ids, vals, context=None):
ir_values_obj = self.pool.get('ir.values')
data_obj = self.pool.get('ir.model.data')
menu_obj = self.pool.get('ir.ui.menu')
res = {}
wizard = self.browse(cr, uid, ids)[0]
if wizard.sale_orders:
menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_invoicing_sales_order_lines').id
menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['ir.ui.menu'], [(4,group_id)])
if wizard.deli_orders:
menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_action_picking_list_to_invoice').id
menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['ir.ui.menu'], [(4,group_id)])
if wizard.picking_policy:
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], 'one')
if wizard.time_unit:
prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
product_obj = self.pool.get('product.product')
product_obj.write(cr, uid, prod_id, {'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy)
if wizard.task_work and wizard.time_unit:
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
self.pool.get('res.company').write(cr, uid, [company_id], {
'project_time_mode_id': wizard.time_unit.id
}, context=context)
return res
def set_groups(self, cr, uid, ids, vals, context=None):
data_obj = self.pool.get('ir.model.data')
users_obj = self.pool.get('res.users')
groups_obj = self.pool.get('res.groups')
ir_values_obj = self.pool.get('ir.values')
dummy,user_group_id = data_obj.get_object_reference(cr, uid, 'base', 'group_user')
for group in vals.keys():
if group.startswith('group_'):
dummy,group_id = data_obj.get_object_reference(cr, uid, 'base', group)
if vals[group]:
groups_obj.write(cr, uid, [user_group_id], {'implied_ids': [(4,group_id)]})
users_obj.write(cr, uid, [uid], {'groups_id': [(4,group_id)]})
ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['res.users'], [(4,group_id)])
else:
groups_obj.write(cr, uid, [user_group_id], {'implied_ids': [(3,group_id)]})
users_obj.write(cr, uid, [uid], {'groups_id': [(3,group_id)]})
ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['res.users'], [(3,group_id)])
sale_configuration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+121
View File
@@ -0,0 +1,121 @@
<openerp>
<data>
<record id="view_sales_config" model="ir.ui.view">
<field name="name">Sales Application</field>
<field name="model">res.config</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<form position="replace">
<form string="Sale Configuration">
<separator string="Picking and Invoice Policy" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="sale_orders"/>
<newline/>
<field name="deli_orders"/>
<newline/>
<field name="task_work"/>
<newline/>
<field name="timesheet"/>
<newline/>
</group>
<group colspan="4" col="4">
<field name="order_policy" attrs="{'invisible':['|',('sale_orders','=',False),('deli_orders','=',False)]}"/>
<newline/>
<field name="charge_delivery" attrs="{'invisible':[('sale_orders','=',False), ('deli_orders','=',False)]}"/>
<newline/>
<field name="picking_policy" attrs="{'invisible':[('deli_orders','=',False)]}"/>
<newline/>
<field name="time_unit" domain="[('category_id.name','=','Working Time')]" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)],'required': [('timesheet','=',True)]}"/>
</group>
</group>
<separator string="Sale Order" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="group_sale_pricelist_per_customer"/>
<newline/>
<group colspan="4" col="4">
<field name="tax_policy" />
<field name="tax_value" nolabel="1"/>
</group>
<newline/>
<field name="sale_margin"/>
<newline/>
<field name="warning"/>
<newline/>
</group>
<group colspan="4" col="4">
<newline/>
<field name="group_sale_uom_per_product"/>
<newline/>
<field name="group_sale_delivery_address"/>
<newline/>
<field name="group_sale_disc_per_sale_order_line"/>
<newline/>
<field name="sale_layout"/>
<newline/>
<field name="sale_journal"/>
<newline/>
</group>
</group>
<separator string="Contracts" colspan="4"/>
<group colspan="4" col="4">
<group colspan="4" col="4">
<field name="account_analytic_analysis"/>
<newline/>
</group>
</group>
<group col="4" colspan="4" name="emails">
<group col="2" colspan="2">
<separator string="Plugins" colspan="2"/>
<field name="plugin_thunderbird" colspan="2"/>
<newline/>
<field name="plugin_outlook" colspan="2"/>
</group>
</group>
<group colspan="4" col="4" name="synchronization">
<separator string="Import and Synchronize data from an other application" colspan="4"/>
<group colspan="2" col="2">
<field name="import_sugarcrm"/>
<newline/>
<field name="import_google"/>
</group>
</group>
<group colspan="4" col="4">
<group colspan="2" col="2">
<separator string="Documents and Wiki" colspan="2"/>
<field name="wiki_sale_faq" />
</group>
<group colspan="2" col="2">
<separator string="Customer Form" colspan="2"/>
<field name="base_contact"/>
<newline/>
<field name="google_map"/>
</group>
</group>
</form>
</form>
</field>
</record>
<record id="action_sale_config" model="ir.actions.act_window">
<field name="name">Configure Sales Application</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.config</field>
<field name="view_id" ref="view_sales_config"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem id="menu_sale_config" name="Sales" parent="base.menu_config" sequence="1" action="action_sale_config"/>
</data>
</openerp>
+4 -196
View File
@@ -28,7 +28,11 @@ from tools.translate import _
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, float_compare
import decimal_precision as dp
import netsvc
<<<<<<< TREE
from openerp.addons.base.res import res_config_sale as sale_config
=======
#from openerp.addons.base.res import res_config_sale as sale_config
>>>>>>> MERGE-SOURCE
class sale_shop(osv.osv):
_name = "sale.shop"
@@ -1331,200 +1335,4 @@ class sale_order_line(osv.osv):
sale_order_line()
sale_config.MODULE_LIST += [
'account_analytic_analysis','project_timesheet', 'project_mrp', 'delivery',
'sale_margin', 'sale_journal'
]
class sale_configuration(osv.osv_memory):
_inherit = 'sale.configuration'
_columns = {
'sale_orders': fields.boolean('Based on Sales Orders',),
'deli_orders': fields.boolean('Based on Delivery Orders'),
'task_work': fields.boolean('Based on Tasks\' Work'),
'timesheet': fields.boolean('Based on Timesheet'),
'order_policy': fields.selection([
('manual', 'Invoice Based on Sales Orders'),
('picking', 'Invoice Based on Deliveries'),
], 'Main Method Based On', required=True, help="You can generate invoices based on sales orders or based on shippings."),
'charge_delivery': fields.boolean('Do you charge the delivery?'),
'time_unit': fields.many2one('product.uom','Working Time Unit'),
'picking_policy' : fields.boolean("Deliver all products at once?"),
'group_sale_pricelist_per_customer':fields.boolean("Pricelist per customer ",help="Group to Activate pricelist to manage prices per customer"),
'group_sale_uom_per_product':fields.boolean("UOM per product",help="Group to Allow different unit of measure per product"),
'group_sale_delivery_address':fields.boolean("Multiple Address",help="Group To Allow delivery address different from invoice address"),
'group_sale_disc_per_sale_order_line':fields.boolean("Discounts per sale order lines ",help="Group to apply discounts per sale order lines"),
'sale_layout':fields.boolean("Notes & subtotals per line",help="Install sale_layout module: This module provides features to improve the layout of the Sales Order.."),
'warning': fields.boolean("Alerts by products or customers",
help="Install warning module: Module to trigger warnings in OpenERP objects."),
'tax_value' : fields.float('Value'),
'tax_value_id': fields.many2one('account.tax.template'),
'tax_policy': fields.selection([
('no_tax', 'No Tax'),
('global_on_order', 'Global On Order'),
('on_order_line', 'On Order Lines'),
], 'Taxes', required=True),
'sale_margin': fields.boolean("Display Margin For Users",
help="Install sale_margin module: This module adds the 'Margin' on sales order."),
'sale_journal': fields.boolean("Invoice journal?",
help="Install sale_journal module: The sales journal modules allows you to categorise your sales and deliveries (picking lists) between different journals."),
}
def default_get(self, cr, uid, fields_list, context=None):
ir_values_obj = self.pool.get('ir.values')
data_obj = self.pool.get('ir.model.data')
obj_tax_temp = self.pool.get('account.tax.template')
res = super(sale_configuration, self).default_get(
cr, uid, fields_list, context=context)
defaults = {}
module_list = sale_config.MODULE_LIST
defaults.update(self.get_installed_modules(cr, uid, module_list, context=context))
defaults.update(self.get_applied_groups(cr, uid, context=context))
for val in ir_values_obj.get(cr, uid, 'default', False, ['sale.order']):
defaults.update({val[1]: val[2]})
for k in defaults.keys():
if k in ['project_timesheet','project_mrp']:
defaults.update({'task_work': True})
prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
uom_id = self.pool.get('product.product').browse(cr, uid, prod_id).uom_id.id
defaults.update({'time_unit': uom_id})
if k in ['account_analytic_analysis']:
defaults.update({'timesheet': True})
prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
uom_id = self.pool.get('product.product').browse(cr, uid, prod_id).uom_id.id
defaults.update({'time_unit': uom_id})
if k == 'delivery':
defaults.update({'sale_orders': True, 'deli_orders': True, 'charge_delivery': True})
if k == 'picking_policy' and defaults[k]=='one':
defaults.update({'picking_policy': True})
if k == 'order_policy':
defaults.update({'order_policy': defaults.get('order_policy')})
if k == 'tax_policy' and defaults[k] == ['global_on_order','on_order_line']:
ref_tax_ids = obj_tax_temp.search(cr, uid, [('type_tax_use','in', ('sale','all'))], context=context, order="sequence, id desc", limit=1)
res.update({'tax_value_id': ref_tax_ids and ref_tax_ids[0] or False})
else:
res.update({k: False})
res.update(defaults)
return res
_defaults = {
'order_policy': 'manual',
'tax_policy': 'global_on_order',
'time_unit': lambda self, cr, uid, c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c) and self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c)[0] or False,
}
#TODO: Need to check
# def onchange_order(self, cr, uid, ids, sale, deli, context=None):
# res = {}
# if sale:
# res.update({'order_policy': 'manual'})
# elif deli:
# res.update({'order_policy': 'picking'})
# return {'value':res}
def apply_groups(self, cr, uid, ids, group_name, apply=True, context=None):
data_obj = self.pool.get('ir.model.data')
users_obj = self.pool.get('res.users')
groups_obj = self.pool.get('res.groups')
dummy,group_id = data_obj.get_object_reference(cr, uid, 'base', group_name)
dummy,user_group_id = data_obj.get_object_reference(cr, uid, 'base', 'group_user')
if apply:
groups_obj.write(cr, uid, [user_group_id], {'implied_ids': [(4,group_id)]})
users_obj.write(cr, uid, [uid], {'groups_id': [(4,group_id)]})
else:
groups_obj.write(cr, uid, [user_group_id], {'implied_ids': [(3,group_id)]})
users_obj.write(cr, uid, [uid], {'groups_id': [(3,group_id)]})
def execute(self, cr, uid, ids, vals, context=None):
#TODO: TO BE IMPLEMENTED
ir_values_obj = self.pool.get('ir.values')
data_obj = self.pool.get('ir.model.data')
menu_obj = self.pool.get('ir.ui.menu')
module_obj = self.pool.get('ir.module.module')
users_obj = self.pool.get('res.users')
groups_obj = self.pool.get('res.groups')
module_name = []
group_id = data_obj.get_object(cr, uid, 'base', 'group_sale_salesman').id
wizard = self.browse(cr, uid, ids)[0]
if wizard.sale_orders:
menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_invoicing_sales_order_lines').id
menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
if wizard.deli_orders:
menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_action_picking_list_to_invoice').id
menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
if wizard.group_sale_pricelist_per_customer:
self.apply_groups(cr, uid, ids, 'group_sale_pricelist_per_customer', context=context)
else:
self.apply_groups(cr, uid, ids, 'group_sale_pricelist_per_customer', False, context=context)
if wizard.group_sale_uom_per_product:
self.apply_groups(cr, uid, ids, 'group_sale_uom_per_product', context=context)
else:
self.apply_groups(cr, uid, ids, 'group_sale_uom_per_product', False, context=context)
if wizard.group_sale_delivery_address:
self.apply_groups(cr, uid, ids, 'group_sale_delivery_address', context=context)
else:
self.apply_groups(cr, uid, ids, 'group_sale_delivery_address', False, context=context)
if wizard.group_sale_disc_per_sale_order_line:
self.apply_groups(cr, uid, ids, 'group_sale_disc_per_sale_order_line', context=context)
else:
self.apply_groups(cr, uid, ids, 'group_sale_disc_per_sale_order_line', False, context=context)
if wizard.timesheet:
vals['account_analytic_analysis'] = True
else:
vals['account_analytic_analysis'] = False
if wizard.task_work:
vals['project_timesheet'] = True
vals['project_mrp'] = True
else:
vals['project_timesheet'] = False
vals['project_mrp'] = False
if wizard.charge_delivery:
vals['delivery'] = True
else:
vals['delivery'] = False
if wizard.warning:
vals['warning'] = True
else:
vals['warning'] = False
if wizard.sale_layout:
vals['sale_layout'] = True
else:
vals['sale_layout'] = False
if wizard.picking_policy:
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], 'one')
if wizard.time_unit:
prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
product_obj = self.pool.get('product.product')
product_obj.write(cr, uid, prod_id, {'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy)
if wizard.task_work and wizard.time_unit:
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
self.pool.get('res.company').write(cr, uid, [company_id], {
'project_time_mode_id': wizard.time_unit.id
}, context=context)
super(sale_configuration, self).execute(cr, uid, ids, vals, context=context)
sale_configuration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-66
View File
@@ -503,71 +503,5 @@
<menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5" groups="base.group_extended"/>
<menuitem id="menu_invoicing_sales_order_lines" parent="base.menu_invoiced" action="action_order_line_tree2" sequence="2" groups="base.group_no_one"/>
<!-- Configartion View -->
<record id="view_config_picking_policy_sales" model="ir.ui.view">
<field name="name">Configure Sales Application</field>
<field name="model">sale.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_config_picking_policy"/>
<field name="arch" type="xml">
<xpath expr="//form/separator[@string='Contracts']" position="before">
<separator string="Picking and Invoice Policy" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="sale_orders"/>
<newline/>
<field name="deli_orders"/>
<newline/>
<field name="task_work"/>
<newline/>
<field name="timesheet"/>
<newline/>
</group>
<group colspan="4" col="4">
<field name="order_policy" attrs="{'invisible':['|',('sale_orders','=',False),('deli_orders','=',False)]}"/>
<newline/>
<field name="charge_delivery" attrs="{'invisible':[('sale_orders','=',False), ('deli_orders','=',False)]}"/>
<newline/>
<field name="picking_policy" attrs="{'invisible':[('deli_orders','=',False)]}"/>
<newline/>
<field name="time_unit" domain="[('category_id.name','=','Working Time')]" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)],'required': [('timesheet','=',True)]}"/>
</group>
</group>
<separator string="Sale Order" colspan="4"/>
<group colspan="4" col="8">
<group colspan="4" col="4">
<field name="group_sale_pricelist_per_customer"/>
<newline/>
<group colspan="4" col="4">
<field name="tax_policy" />
<field name="tax_value" nolabel="1" attrs="{'invisible': [('tax_policy','in',['no_tax','global_on_order'])]}"/>
<field name="tax_value_id" nolabel="1" attrs="{'invisible': [('tax_policy','in',['no_tax','on_order_line'])]}"/>
</group>
<newline/>
<field name="sale_margin"/>
<newline/>
<field name="warning"/>
<newline/>
</group>
<group colspan="4" col="4">
<newline/>
<field name="group_sale_uom_per_product"/>
<newline/>
<field name="group_sale_delivery_address"/>
<newline/>
<field name="group_sale_disc_per_sale_order_line"/>
<newline/>
<field name="sale_layout"/>
<newline/>
<field name="sale_journal"/>
<newline/>
</group>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
+10 -15
View File
@@ -20,16 +20,6 @@
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="base.group_sale_pricelist_per_customer" model="res.groups">
<field name="name">Sales Pricelists</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_uom_per_product" model="res.groups">
<field name="name">Product UOM</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_delivery_address" model="res.groups">
<field name="name">Addresses in Sale Orders</field>
<field name="category_id" ref="base.module_category_usability"/>
@@ -40,17 +30,22 @@
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_taxes_global_or_online" model="res.groups">
<field name="name">Sales Taxes Global/on line</field>
<record id="base.group_sale_taxes_global_on_order" model="res.groups">
<field name="name">Sales Taxes Global on Order</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_sale_taxes_on_order_line" model="res.groups">
<field name="name">Sales Taxes on Order Lines</field>
<field name="category_id" ref="base.module_category_usability"/>
</record>
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(6,0,[ref('base.group_sale_pricelist_per_customer'),
ref('base.group_sale_uom_per_product'),
<field name="implied_ids" eval="[(6,0,[
ref('base.group_sale_delivery_address'),
ref('base.group_sale_disc_per_sale_order_line'),
ref('base.group_sale_taxes_global_or_online'),
ref('base.group_sale_taxes_global_on_order'),
ref('base.group_sale_taxes_on_order_line'),
])]"/>
</record>
+2 -2
View File
@@ -82,8 +82,8 @@
-
I set order policy "Deliver & invoice on demand" as default policy.
-
!record {model: sale.configuration, id: sale_configuration_0}:
!record {model: res.config, id: sale_configuration_0}:
order_policy: 'manual'
-
!python {model: sale.configuration}: |
!python {model: res.config}: |
self.execute(cr, uid, [ref("sale_configuration_0")], {})