diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 98f7a7d5134..726eab3680c 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -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: diff --git a/addons/account/res_config.py b/addons/account/res_config.py new file mode 100644 index 00000000000..6c5f32d4812 --- /dev/null +++ b/addons/account/res_config.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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() \ No newline at end of file diff --git a/addons/account_chart/res_config.py b/addons/account_chart/res_config.py new file mode 100644 index 00000000000..5bd2b98ca66 --- /dev/null +++ b/addons/account_chart/res_config.py @@ -0,0 +1,8 @@ +class account_configuration(osv.osv_memory): + _inherit = 'res.config' + + _columns = { + 'tax_value' : fields.many2one('account.tax', 'Value'), + } + +account_configuration() \ No newline at end of file diff --git a/addons/crm/__init__.py b/addons/crm/__init__.py index 214c5c3d450..95cf8b53f27 100644 --- a/addons/crm/__init__.py +++ b/addons/crm/__init__.py @@ -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: diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 4968176e826..5f71c404976 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -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': [ diff --git a/addons/crm/res_config.py b/addons/crm/res_config.py new file mode 100644 index 00000000000..6780ac17aa7 --- /dev/null +++ b/addons/crm/res_config.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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() \ No newline at end of file diff --git a/addons/crm/res_config_view.xml b/addons/crm/res_config_view.xml new file mode 100644 index 00000000000..807685bda83 --- /dev/null +++ b/addons/crm/res_config_view.xml @@ -0,0 +1,36 @@ + + + + + Sales Application + res.config + form + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/hr/i18n/zh_CN.po b/addons/hr/i18n/zh_CN.po index adbaa2c31ea..394479311ca 100644 --- a/addons/hr/i18n/zh_CN.po +++ b/addons/hr/i18n/zh_CN.po @@ -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 diff --git a/addons/import_google/i18n/nl.po b/addons/import_google/i18n/nl.po new file mode 100644 index 00000000000..06d6991bb58 --- /dev/null +++ b/addons/import_google/i18n/nl.po @@ -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 , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \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 \n" +"Language-Team: Dutch \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" diff --git a/addons/plugin_outlook/plugin_outlook.xml b/addons/plugin_outlook/plugin_outlook.xml index 68e265e0730..b03932c7e94 100644 --- a/addons/plugin_outlook/plugin_outlook.xml +++ b/addons/plugin_outlook/plugin_outlook.xml @@ -48,9 +48,9 @@ new - + Install Outlook Plug-In diff --git a/addons/plugin_thunderbird/plugin_thunderbird.xml b/addons/plugin_thunderbird/plugin_thunderbird.xml index 76405330c89..dff9a186c54 100644 --- a/addons/plugin_thunderbird/plugin_thunderbird.xml +++ b/addons/plugin_thunderbird/plugin_thunderbird.xml @@ -55,9 +55,9 @@ new - + diff --git a/addons/product/__init__.py b/addons/product/__init__.py index 4247b49d41b..a7e0be09dc5 100644 --- a/addons/product/__init__.py +++ b/addons/product/__init__.py @@ -23,5 +23,6 @@ import pricelist import report import partner import wizard +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/product/res_config.py b/addons/product/res_config.py new file mode 100644 index 00000000000..5211f302bb9 --- /dev/null +++ b/addons/product/res_config.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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() \ No newline at end of file diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 5c993b9cd61..4fba712c00a 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -18,6 +18,21 @@ Product Variant + + + Sales Pricelists + + + + + Product UOM + + + + + + product pricelist company rule diff --git a/addons/sale/__init__.py b/addons/sale/__init__.py index b26486e1425..2688b61ddd9 100644 --- a/addons/sale/__init__.py +++ b/addons/sale/__init__.py @@ -29,5 +29,6 @@ import wizard import report import company import edi +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index ff2cfb03f5f..e1b3c57de00 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -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': [ diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py new file mode 100644 index 00000000000..540fe9da97a --- /dev/null +++ b/addons/sale/res_config.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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: \ No newline at end of file diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml new file mode 100644 index 00000000000..82d1a18684d --- /dev/null +++ b/addons/sale/res_config_view.xml @@ -0,0 +1,121 @@ + + + + + Sales Application + res.config + form + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + Configure Sales Application + ir.actions.act_window + res.config + + form + form + + + + +
+
+ \ No newline at end of file diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 343bdcbfdcd..9dc4781e26c 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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: diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 05c02bb208b..3c6c2330660 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -503,71 +503,5 @@ - - - - Configure Sales Application - sale.configuration - form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index 9435c449387..315433447ac 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -20,16 +20,6 @@
- - Sales Pricelists - - - - - Product UOM - - - Addresses in Sale Orders @@ -40,17 +30,22 @@ - - Sales Taxes Global/on line + + Sales Taxes Global on Order + + + + + Sales Taxes on Order Lines - diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index dcbc4ebc56b..de93b76795b 100644 --- a/addons/sale/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -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")], {})