diff options
| author | Raphael Collet <rco@openerp.com> | 2012-03-21 16:27:51 +0100 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2012-03-21 16:27:51 +0100 |
| commit | da3e32700ab1bedf91c1d524fa02fb6232b1fbae (patch) | |
| tree | e31e2e6fa584c19c7ce1fef5876e6abdad23c17c /addons | |
| parent | 3ed94db8e441010a1598c974a7108e7aa11832be (diff) | |
| parent | effbaddd37e1512377d7313a9f215986fc7420db (diff) | |
[MERGE] trunk-v62_config_sale-uco (new sale config wizard)
bzr revid: rco@openerp.com-20120321152751-9okrox08jmd2wrxu
Diffstat (limited to 'addons')
36 files changed, 661 insertions, 288 deletions
diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index 60d30f9fff0..bbbbb5c491f 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -3,15 +3,15 @@ <data> <!-- - Analytic Account form + Analytic Account form Remove information on Account data => because they move on analysis sheet create a page with invoicing informations --> <record id="account_analytic_account_invoice_stat_form" model="ir.ui.view"> - <field name="name">account.analytic.account.invoice.stat.form.inherit</field> - <field name="model">account.analytic.account</field> - <field name="type">form</field> + <field name="name">account.analytic.account.invoice.stat.form.inherit</field> + <field name="model">account.analytic.account</field> + <field name="type">form</field> <field name="inherit_id" ref="hr_timesheet_invoice.account_analytic_account_form_form"/> <field eval="18" name="priority"/> <field name="arch" type="xml"> @@ -30,9 +30,9 @@ </record> <record id="hr_timesheet.account_analytic_account_form_form" model="ir.ui.view"> - <field name="name">account.analytic.account.invoice.form.inherit</field> - <field name="model">account.analytic.account</field> - <field name="type">form</field> + <field name="name">account.analytic.account.invoice.form.inherit</field> + <field name="model">account.analytic.account</field> + <field name="type">form</field> <field name="inherit_id" ref="account.view_account_analytic_account_form"/> <field eval="18" name="priority"/> <field name="arch" type="xml"> @@ -69,7 +69,7 @@ </tree> </field> </page> - <page string="Stats by user"> + <page string="Stats by user"> <field colspan="4" name="user_ids" nolabel="1"> <tree string="Users"> <field name="user"/> @@ -97,19 +97,33 @@ </field> </field> </record> - - <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view"> - <field name="name">account.analytic.account.tree</field> - <field name="model">account.analytic.account</field> + + <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view"> + <field name="name">account.analytic.account.tree</field> + <field name="model">account.analytic.account</field> <field name="inherit_id" ref="account.view_account_analytic_account_list"/> - <field name="type">tree</field> - <field name="arch" type="xml"> - <field name="date" position="before"> + <field name="type">tree</field> + <field name="arch" type="xml"> + <field name="date" position="before"> <field name="last_invoice_date"/> <field name="ca_to_invoice"/> </field> </field> </record> + <record id="view_contract_installation" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="inherit_id" ref="sale.view_sales_config"/> + <field name="type">form</field> + <field name="arch" type="xml"> + <group name="config_contracts" position="inside"> + <separator string="Contracts" colspan="4"/> + <field name="module_analytic_user_function"/> + <field name="module_analytic_journal_billing_rate"/> + </group> + </field> + </record> + </data> </openerp> diff --git a/addons/base_setup/base_setup_views.xml b/addons/base_setup/base_setup_views.xml index 63bf79b37d7..442986cff61 100644 --- a/addons/base_setup/base_setup_views.xml +++ b/addons/base_setup/base_setup_views.xml @@ -142,18 +142,19 @@ <field name="sequence">1</field> </record> - <record id="base.sale_settings_form_view" model="ir.ui.view"> + <record id="base.view_sale_config_settings" model="ir.ui.view"> <field name="name">sale.config.settings</field> <field name="model">sale.config.settings</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Configure Sales & CRM"> - <group name="sales" colspan="4"> - </group> - <group name="crm" colspan="4"> - </group> - <group name="plugins" colspan="4"> - </group> + <group name="config_sale" colspan="4"/> + <group name="config_contracts" colspan="4"/> + <group name="config_emails" colspan="4"/> + <group name="config_crm" colspan="4"/> + <label colspan="2"/> + <button string="Cancel" icon="gtk-cancel" special="cancel"/> + <button string="Apply" icon="gtk-ok" type="object" name="execute"/> </form> </field> </record> @@ -162,9 +163,9 @@ <field name="name">Configure Sales & CRM</field> <field name="type">ir.actions.act_window</field> <field name="res_model">sale.config.settings</field> - <field name="view_id" ref="base.sale_settings_form_view"/> - <field name="view_type">form</field> + <field name="view_id" ref="base.view_sale_config_settings"/> <field name="view_mode">form</field> + <field name="target">new</field> </record> </data> 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..66b83a75f18 --- /dev/null +++ b/addons/crm/res_config.py @@ -0,0 +1,126 @@ +# -*- 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 = 'sale.config.settings' + + _columns = { + 'module_crm_caldav': fields.boolean("Caldav Synchronization", + help="""Use protocol caldav to synchronize meetings with other calendar applications (like Sunbird). + This installs the module crm_caldav."""), + 'fetchmail_crm': fields.boolean("Lead/Opportunity mail gateway", + help="Create leads automatically from an email gateway."), + 'default_server': fields.char('Server Name', size=256), + 'default_port': fields.integer('Port'), + 'default_type': fields.selection([ + ('pop', 'POP Server'), + ('imap', 'IMAP Server'), + ('local', 'Local Server'), + ], 'Server Type'), + 'default_is_ssl': fields.boolean('SSL/TLS', + help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP=995)"), + 'default_user': fields.char('Username', size=256), + 'default_password': fields.char('Password', size=1024), + 'module_import_sugarcrm': fields.boolean("SugarCRM Import", + help="""Import SugarCRM leads, opportunities, users, accounts, contacts, employees, meetings, phonecalls, emails, project and project tasks data. + This installs the module import_sugarcrm."""), + 'module_import_google': fields.boolean("Google Import", + help="""Import google contact in partner address and add google calendar events details in Meeting. + This installs the module import_google."""), + 'module_wiki_sale_faq': fields.boolean("Install a sales FAQ", + help="""This provides demo data, thereby creating a Wiki Group and a Wiki Page for Wiki Sale FAQ. + This installs the module wiki_sale_faq."""), + 'module_base_contact': fields.boolean("Manage a several addresses per customer", + help="""Lets you define: + * contacts unrelated to a partner, + * contacts working at several addresses (possibly for different partners), + * contacts with possibly different job functions. + This installs the module base_contact."""), + 'module_google_map': fields.boolean("Google maps on customer", + help="""Locate customers on Google Map. + This installs the module google_map."""), + } + + _defaults = { + 'default_type': 'pop', + } + + def onchange_server_type(self, cr, uid, ids, server_type, ssl, context=None): + values = {} + if server_type == 'pop': + values['default_port'] = ssl and 995 or 110 + elif server_type == 'imap': + values['default_port'] = ssl and 993 or 143 + else: + values['default_server'] = False + values['default_port'] = 0 + return {'value': values} + + def get_default_email_configurations(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + server_count = self.pool.get('fetchmail.server').search(cr, uid, + [('name','=','Incoming Leads'), ('state','=','done')], count=True) + return { + 'fetchmail_crm': bool(server_count), + 'default_server': ir_values.get_default(cr, uid, 'fetchmail.server', 'server') or False, + 'default_port': ir_values.get_default(cr, uid, 'fetchmail.server', 'port') or False, + 'default_type': ir_values.get_default(cr, uid, 'fetchmail.server', 'type') or False, + 'default_is_ssl': ir_values.get_default(cr, uid, 'fetchmail.server', 'is_ssl') or False, + 'default_user': ir_values.get_default(cr, uid, 'fetchmail.server', 'user') or False, + 'default_password': ir_values.get_default(cr, uid, 'fetchmail.server', 'password') or False, + } + + def set_email_configurations(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + fetchmail_obj = self.pool.get('fetchmail.server') + config = self.browse(cr, uid, ids[0], context) + model_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'crm.lead')]) + if config.fetchmail_crm and model_ids: + fetchmail_vals = { + 'name': 'Incoming Leads', + 'object_id': model_ids[0], + 'server': config.default_server, + 'port': config.default_port, + 'is_ssl': config.default_is_ssl, + 'type': config.default_type, + 'user': config.default_user, + 'password': config.default_password, + } + server_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Leads'), ('state','=','done')]) + if not server_ids: + server_ids = [fetchmail_obj.create(cr, uid, fetchmail_vals, context=context)] + else: + server_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Leads')], context=context) + fetchmail_obj.write(cr, uid, server_ids, fetchmail_vals, context=context) + fetchmail_obj.button_confirm_login(cr, uid, server_ids, context=None) + ir_values.set_default(cr, uid, 'fetchmail.server', 'server', config.default_server) + ir_values.set_default(cr, uid, 'fetchmail.server', 'port', config.default_port) + ir_values.set_default(cr, uid, 'fetchmail.server', 'is_ssl', config.default_is_ssl) + ir_values.set_default(cr, uid, 'fetchmail.server', 'type', config.default_type) + ir_values.set_default(cr, uid, 'fetchmail.server', 'user', config.default_user) + ir_values.set_default(cr, uid, 'fetchmail.server', 'password', config.default_password) + else: + server_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Leads'), ('state','=','done')]) + fetchmail_obj.set_draft(cr, uid, server_ids, context=None) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/res_config_view.xml b/addons/crm/res_config_view.xml new file mode 100644 index 00000000000..32d84ce3b67 --- /dev/null +++ b/addons/crm/res_config_view.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="view_sales_config_crm" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="type">form</field> + <field name="inherit_id" ref="mail.view_sales_config_plugin"/> + <field name="arch" type="xml"> + <group name="config_emails" position="inside"> + <separator string="Emails" colspan="4"/> + <field name="fetchmail_crm"/> + <group colspan="2" attrs="{'invisible': [('fetchmail_crm','=',False)]}"> + <field name="default_server" attrs="{'required': [('fetchmail_crm','=',True)]}"/> + <field name="default_type" nolabel="1" on_change="onchange_server_type(default_type, default_is_ssl)" attrs="{'required': [('fetchmail_crm','=',True)]}"/> + <field name="default_port" attrs="{'required': [('fetchmail_crm','=',True)]}"/> + <field name="default_is_ssl" on_change="onchange_server_type(default_type, default_is_ssl)"/> + <newline/> + <field name="default_user" attrs="{'required': [('fetchmail_crm','=',True)]}"/> + <field name="default_password" password="True" attrs="{'required': [('fetchmail_crm','=',True)]}"/> + </group> + </group> + <group name="config_crm" position="inside"> + <separator string="Import and Synchronize data from an other application" colspan="4"/> + <group colspan="2" col="2"> + <field name="module_import_sugarcrm"/> + <field name="module_import_google"/> + </group> + <group colspan="2" col="2"> + <field name="module_crm_caldav"/> + </group> + <separator string="Documents and Wiki" colspan="4"/> + <field name="module_wiki_sale_faq" /> + <separator string="Customer Form" colspan="4"/> + <field name="module_base_contact"/> + <field name="module_google_map"/> + </group> + </field> + </record> + + <menuitem id="base.menu_sale_config" name="Sales & CRM" parent="base.menu_config" sequence="1" action="base.action_sale_config"/> + + </data> +</openerp> diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 9f95a430f4e..77193cde2bf 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -106,7 +106,7 @@ class delivery_carrier(osv.osv): # if using advanced pricing per destination: do not change if record.use_detailed_pricelist: continue - + # not using advanced pricing per destination: override grid grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context) @@ -250,23 +250,4 @@ class delivery_grid_line(osv.osv): delivery_grid_line() -class define_delivery_steps(osv.osv_memory): - _name = 'delivery.define.delivery.steps.wizard' - - _columns = { - 'picking_policy' : fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], 'Picking Policy'), - } - _defaults = { - 'picking_policy': lambda s,c,u,ctx: s.pool.get('sale.order').default_get(c,u,['picking_policy'],context=ctx)['picking_policy'] - } - - def apply_cb(self, cr, uid, ids, context=None): - ir_values_obj = self.pool.get('ir.values') - wizard = self.browse(cr, uid, ids, context=context)[0] - ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], wizard.picking_policy) - return {'type' : 'ir.actions.act_window_close'} - -define_delivery_steps() - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 1e47d815084..5d6d9cd2d40 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -337,35 +337,5 @@ <field name="sequence">10</field> </record> - <record model="ir.ui.view" id="define_delivery_steps_form"> - <field name="name">delivery.define_delivery_steps</field> - <field name="model">delivery.define.delivery.steps.wizard</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Setup Your Picking Policy"> - <separator string="Choose Your Default Picking Policy" colspan="4"/> - <field name="picking_policy" /> - <separator string="" colspan="4"/> - <group colspan="4"> - <button string="Cancel" icon="gtk-cancel" special="cancel" /> - <button string="Apply" icon="gtk-apply" name="apply_cb" type="object" /> - </group> - </form> - </field> - </record> - - <record model="ir.actions.act_window" id="action_define_delivery_steps"> - <field name="name">Setup Your Picking Policy</field> - <field name="res_model">delivery.define.delivery.steps.wizard</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - - <record model="ir.actions.todo" id="todo_define_delivery_steps"> - <field name="action_id" ref="action_define_delivery_steps" /> - <field name="category_id" ref="base.category_sales_management_config"/> - <field name="type">once</field> - </record> </data> </openerp> diff --git a/addons/delivery/test/delivery_cost.yml b/addons/delivery/test/delivery_cost.yml index f8d6787a0c5..521f260e136 100644 --- a/addons/delivery/test/delivery_cost.yml +++ b/addons/delivery/test/delivery_cost.yml @@ -67,9 +67,9 @@ - I set default delivery policy. - - !record {model: delivery.define.delivery.steps.wizard, id: default_delivery_policy}: + !record {model: sale.config.settings, id: default_delivery_policy}: {} - - !python {model: delivery.define.delivery.steps.wizard}: | - self.apply_cb(cr, uid, [ref('default_delivery_policy')], context=context) + !python {model: sale.config.settings}: | + self.execute(cr, uid, [ref('default_delivery_policy')], context=context) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index 3190b8910ae..30cafc5a0b4 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -11,7 +11,7 @@ <group colspan="2" col="2" name="invoice_data"> <separator colspan="2" string="Invoicing Data"/> <field name="to_invoice" widget="selection"/> - <field name="pricelist_id" domain="[('type','=','sale')]" attrs="{'required':[('to_invoice','!=',False)]}"/> + <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]" attrs="{'required':[('to_invoice','!=',False)]}"/> <field name="amount_max"/> </group> <group colspan="2" col="2" name="invoice_stats"> diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py index 4787883ef9c..72164b89865 100644 --- a/addons/mail/__init__.py +++ b/addons/mail/__init__.py @@ -23,6 +23,7 @@ import mail_message import mail_thread import res_partner import wizard +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index 8085d301364..1cad3fafa5d 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -62,6 +62,7 @@ The main features are: "res_partner_view.xml", 'security/ir.model.access.csv', 'mail_data.xml', + 'res_config_view.xml', ], 'installable': True, 'auto_install': False, diff --git a/addons/mail/res_config.py b/addons/mail/res_config.py new file mode 100644 index 00000000000..89038a43610 --- /dev/null +++ b/addons/mail/res_config.py @@ -0,0 +1,43 @@ +# -*- 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 plugin_configuration(osv.osv_memory): + _inherit = 'sale.config.settings' + + _columns = { + 'module_plugin_thunderbird': fields.boolean('Thunderbird plugin', + help="""The plugin allows you archive email and its attachments to the selected + OpenERP objects. You can select a partner, a task, a project, an analytical + account, or any other object and attach the selected mail as a .eml file in + the attachment of a selected record. You can create documents for CRM Lead, + HR Applicant and Project Issue from the selected emails. + This installs the module plugin_thunderbird."""), + 'module_plugin_outlook': fields.boolean('Outlook plugin', + help="""The Outlook plugin allows you to select an object that you would like to add + to your email and its attachments from MS Outlook. You can select a partner, a task, + a project, an analytical account, or any other object and archive a selected + email into an OpenERP mail message with attachments. + This installs the module plugin_outlook."""), + } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mail/res_config_view.xml b/addons/mail/res_config_view.xml new file mode 100644 index 00000000000..2610538da42 --- /dev/null +++ b/addons/mail/res_config_view.xml @@ -0,0 +1,20 @@ +<openerp> + <data> + + <record id="view_sales_config_plugin" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="type">form</field> + <field name="inherit_id" ref="base.view_sale_config_settings"/> + <field name="arch" type="xml"> + <group name="config_emails" position="after"> + <separator string="Plugins" colspan="4"/> + <field name="module_plugin_thunderbird"/> + <newline/> + <field name="module_plugin_outlook"/> + </group> + </field> + </record> + + </data> +</openerp> diff --git a/addons/mrp_repair/mrp_repair_view.xml b/addons/mrp_repair/mrp_repair_view.xml index fa0ff192f17..dd29de20f9b 100644 --- a/addons/mrp_repair/mrp_repair_view.xml +++ b/addons/mrp_repair/mrp_repair_view.xml @@ -118,7 +118,7 @@ <page string="Invoicing"> <field name="invoice_method" colspan="4"/> <field - name="pricelist_id" context="{'product_id':product_id}" + name="pricelist_id" groups="product.group_sale_pricelist" context="{'product_id':product_id}" attrs="{'readonly':[('invoice_method','=', 'none')]}"/> <field name="partner_invoice_id" attrs="{'readonly':[('invoice_method','=', 'none')]}"/> <!-- <field name="invoice_id"/> --> diff --git a/addons/plugin_outlook/plugin_outlook.xml b/addons/plugin_outlook/plugin_outlook.xml index 37b924f319f..429fbf97a32 100644 --- a/addons/plugin_outlook/plugin_outlook.xml +++ b/addons/plugin_outlook/plugin_outlook.xml @@ -48,11 +48,17 @@ <field name="target">new</field> </record> - <record id="outlook_installer_todo" model="ir.actions.todo"> - <field name="action_id" ref="action_outlook_installer"/> - <field name="category_id" ref="base.category_sales_management_config"/> - <field name="sequence">4</field> - <field name="type">automatic</field> + <!-- Sales Configuration --> + <record id="view_config_outlook_installer" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="type">form</field> + <field name="inherit_id" ref="mail.view_sales_config_plugin"/> + <field name="arch" type="xml"> + <field name="module_plugin_outlook" position="after"> + <button name="%(action_outlook_installer)d" type="action" string="Configure" icon="gtk-execute"/> + </field> + </field> </record> <record id="action_outlook_wizard" model="ir.actions.act_window"> diff --git a/addons/plugin_thunderbird/plugin_thunderbird.xml b/addons/plugin_thunderbird/plugin_thunderbird.xml index 3b4107c8358..ee4801d8925 100644 --- a/addons/plugin_thunderbird/plugin_thunderbird.xml +++ b/addons/plugin_thunderbird/plugin_thunderbird.xml @@ -54,11 +54,18 @@ <field name="view_mode">form</field> <field name="target">new</field> </record> - <record id="thunderbird_installer_todo" model="ir.actions.todo"> - <field name="action_id" ref="action_thunderbird_installer"/> - <field name="category_id" ref="base.category_sales_management_config"/> - <field name="sequence">3</field> - <field name="type">automatic</field> + + <!-- Sales Configuration --> + <record id="view_config_thunderbird_installer" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="type">form</field> + <field name="inherit_id" ref="mail.view_sales_config_plugin"/> + <field name="arch" type="xml"> + <field name="module_plugin_thunderbird" position="after"> + <button name="%(action_thunderbird_installer)d" type="action" string="Configure" icon="gtk-execute"/> + </field> + </field> </record> <menuitem id="base.menu_base_config_plugins" name="Plugins" parent="base.menu_base_config" sequence="10"/> diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 5461bf690bd..f23249c6afc 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -80,7 +80,7 @@ <field name="company_id" groups="base.group_multi_company"/> <field name="shop_id" widget="selection"/> <field name="user_id"/> - <field name="pricelist_id" domain="[('type','=','sale')]"/> + <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]"/> <field name="picking_id" readonly="1" groups="base.group_extended"/> </group> <group colspan="2" col="3"> 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/partner_view.xml b/addons/product/partner_view.xml index 51d012b8577..4d917230acc 100644 --- a/addons/product/partner_view.xml +++ b/addons/product/partner_view.xml @@ -9,7 +9,7 @@ <field name="arch" type="xml"> <page string="Sales & Purchases" position="inside"> <newline/> - <group col="2" colspan="2" groups="base.group_extended"> + <group col="2" colspan="2" groups="product.group_sale_pricelist"> <separator string="Sales Properties" colspan="2"/> <field name="property_product_pricelist"/> </group> diff --git a/addons/product/pricelist_view.xml b/addons/product/pricelist_view.xml index 3ddfe1e6900..c36f2082ff5 100644 --- a/addons/product/pricelist_view.xml +++ b/addons/product/pricelist_view.xml @@ -4,7 +4,8 @@ <menuitem id="base.menu_sale_config_sales" name="Sales" parent="base.menu_base_config" sequence="0" groups="base.group_extended"/> - <menuitem groups="base.group_extended" id="menu_product_pricelist_main" name="Pricelists" parent="base.menu_base_config" sequence="50"/> + <menuitem id="menu_product_pricelist_main" name="Pricelists" + parent="base.menu_base_config" groups="product.group_sale_pricelist" sequence="50"/> <record id="product_pricelist_version_form_view" model="ir.ui.view"> <field name="name">product.pricelist.version.form</field> @@ -195,7 +196,7 @@ </form> </field> </record> - + <record id="product_price_type_action" model="ir.actions.act_window"> <field name="name">Price Types</field> <field name="type">ir.actions.act_window</field> diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index a1857748b9d..2eaf0ead9e0 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -20,7 +20,7 @@ <field name="categ_id" widget="selection" operator="child_of" groups="base.group_extended"/> <newline/> <group expand="0" string="Context..." groups="base.group_extended"> - <field name="pricelist_id" widget="selection" context="{'pricelist': self}" /> + <field name="pricelist_id" widget="selection" context="{'pricelist': self}" groups="product.group_sale_pricelist"/> <separator orientation="vertical" groups="base.group_multi_company" /> <field name="company_id" widget="selection" groups="base.group_multi_company" /> </group> @@ -50,7 +50,7 @@ <field name="name"/> <field name="categ_id" invisible="1"/> <field name="variants" groups="product.group_product_variant"/> - <field name="uom_id" string="UoM"/> + <field name="uom_id" string="UoM" groups="product.group_uom"/> <field name="type"/> <field name="qty_available"/> <field name="virtual_available"/> @@ -87,7 +87,7 @@ </group> <group colspan="1" col="1"> <field name="product_image" widget='image' nolabel="1"/> - </group> + </group> </group> <notebook colspan="4"> @@ -125,11 +125,11 @@ <group colspan="2" col="2" name="uom"> <separator string="Unit of Measure" colspan="2"/> - <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/> + <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/> <field name="uom_po_id" groups="base.group_extended"/> </group> - <group colspan="2" col="2" name="uos" groups="product.group_uos"> + <group colspan="2" col="2" name="uos" groups="product.group_uom"> <separator string="Second UoM" colspan="2"/> <field name="uos_id"/> <field name="uos_coeff"/> @@ -440,7 +440,7 @@ <field name="view_id" ref="product_uom_tree_view"/> <field name="help">Create and manage the units of measure you want to be used in your system. You can define a conversion rate between several Units of Measure within the same category.</field> </record> - <menuitem id="next_id_16" name="Units of Measure" parent="prod_config_main" sequence="65"/> + <menuitem id="next_id_16" name="Units of Measure" parent="prod_config_main" sequence="65" groups="product.group_uom"/> <menuitem action="product_uom_form_action" id="menu_product_uom_form_action" parent="next_id_16"/> <record id="product_uom_categ_form_view" model="ir.ui.view"> @@ -552,7 +552,7 @@ <field name="product_uom"/> <field name="delay"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/> - <field colspan="4" groups="base.group_extended" name="pricelist_ids" nolabel="1" widget="one2many_list"> + <field colspan="4" groups="product.group_sale_pricelist" name="pricelist_ids" nolabel="1" widget="one2many_list"> <tree editable="bottom" string="Pricelist"> <field name="min_quantity"/> <field name="price"/> @@ -674,11 +674,11 @@ <group colspan="2" col="2" name="uom"> <separator string="UOM" colspan="2"/> - <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/> + <field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/> <field name="uom_po_id" groups="base.group_extended"/> </group> - <group colspan="2" col="2" name="uos" groups="product.group_uos"> + <group colspan="2" col="2" name="uos" groups="product.group_uom"> <separator string="Second UoM" colspan="2"/> <field name="uos_id"/> <field name="uos_coeff"/> diff --git a/addons/product/res_config.py b/addons/product/res_config.py new file mode 100644 index 00000000000..6af8c9c26be --- /dev/null +++ b/addons/product/res_config.py @@ -0,0 +1,42 @@ +# -*- 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 sale_config_settings(osv.osv_memory): + _inherit = 'sale.config.settings' + + _columns = { + 'group_sale_pricelist':fields.boolean("Pricelist per Customer", + implied_group='product.group_sale_pricelist', + help="""Allows to manage different prices based on rules per category of customers. + Example: 10% for retailers, promotion of 5 EUR on this product, etc."""), + 'group_purchase_pricelist':fields.boolean("Pricelist per Supplier", + implied_group='product.group_purchase_pricelist', + help="""Allows to manage different prices based on rules per category of Supplier. + Example: 10% for retailers, promotion of 5 EUR on this product, etc."""), + 'group_sale_uom':fields.boolean("UOM per product", + implied_group='product.group_uom', + help="""Allows you to select and maintain different unit of measures per product."""), + 'group_stock_packaging':fields.boolean("Manage packaging by products", + implied_group='product.group_packaging', + help=""" Allows you to create and manage your packaging dimensions and types you want to be maintained in your system."""), +} diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 5c993b9cd61..c8c8b1904e8 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -19,6 +19,26 @@ <field name="category_id" ref="base.module_category_usability"/> </record> + <record id="group_sale_pricelist" model="res.groups"> + <field name="name">Sales Pricelists</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_purchase_pricelist" model="res.groups"> + <field name="name">Purchase Pricelists</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_uom" model="res.groups"> + <field name="name">Multiple UoM per Product</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_packaging" model="res.groups"> + <field name="name">Manage Product Packaging</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + <record model="ir.rule" id="product_pricelist_comp_rule"> <field name="name">product pricelist company rule</field> <field name="model_id" ref="model_product_pricelist"/> diff --git a/addons/product/wizard/product_price_view.xml b/addons/product/wizard/product_price_view.xml index 91fb931b6fa..adc63de872d 100644 --- a/addons/product/wizard/product_price_view.xml +++ b/addons/product/wizard/product_price_view.xml @@ -31,6 +31,7 @@ name="Price List" res_model="product.price_list" src_model="product.product" + groups="product.group_sale_pricelist" view_mode="form" target="new" view_type="form" /> </data> diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index 07873c00592..7a7d4966bf2 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -10,7 +10,7 @@ <field name="warn_customer" position="after"> <group colspan="4" col="4"> <separator colspan="4" string="Invoicing Data"/> - <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection"/> + <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]" widget="selection"/> <field name="to_invoice" widget="selection" string="Invoice Task Work"/> <field name="amount_max" groups="base.group_extended"/> <field name="amount_invoiced" groups="base.group_extended"/> 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..37bc0216e88 --- /dev/null +++ b/addons/sale/res_config.py @@ -0,0 +1,156 @@ +# -*- 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 _ + +class sale_configuration(osv.osv_memory): + _inherit = 'sale.config.settings' + + _columns = { + 'group_invoice_so_lines': fields.boolean('Based on Sales Orders', + implied_group='sale.group_invoice_so_lines', + help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."), + 'group_invoice_deli_orders': fields.boolean('Based on Delivery Orders', + implied_group='sale.group_invoice_deli_orders', + help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."), + 'task_work': fields.boolean('Based on Tasks\' Work', + help="""Lets you transfer the entries under tasks defined for Project Management to + the Timesheet line entries for particular date and particular user with the effect of creating, editing and deleting either ways + and to automatically creates project tasks from procurement lines. + This installs the modules project_timesheet and project_mrp."""), + 'module_account_analytic_analysis': fields.boolean('Based on Timesheet', + help = """For modifying account analytic view to show important data to project manager of services companies. + You can also view the report of account analytic summary user-wise as well as month wise. + This installs the module account_analytic_analysis."""), + 'default_order_policy': fields.selection( + [('manual', 'Invoice Based on Sales Orders'), ('picking', 'Invoice Based on Deliveries')], + 'Main Method Based On', required=True, default_model='sale.order', + help="You can generate invoices based on sales orders or based on shippings."), + 'module_delivery': fields.boolean('Charge delivery costs', + help ="""Allows you to add delivery methods in sale orders and delivery orders. + You can define your own carrier and delivery grids for prices. + This installs the module delivery."""), + 'time_unit': fields.many2one('product.uom', 'Working Time Unit'), + 'default_picking_policy' : fields.boolean("Deliver all products at once", + help = "You can set picking policy on sale order that will allow you to deliver all products at once."), + 'group_sale_delivery_address': fields.boolean("Specify delivery and invoice addresses", + implied_group='sale.group_delivery_invoice_address', + help="Allows you to specify different delivery and invoice addresses on a sale order."), + 'group_discount_per_so_line': fields.boolean("Discount per sale order line", + implied_group='sale.group_discount_per_so_line', + help="Allows you to apply discount per sale order line."), + 'module_sale_layout': fields.boolean("Notes & subtotals per line", + help="""Allows to format sale order lines using notes, separators, titles and subtotals. + This installs the module sale_layout."""), + 'module_warning': fields.boolean("Alerts by products or customers", + help="""To raise user specific warning messages on different products used in Sales Orders, Purchase Orders, Invoices and Deliveries. + This installs the module warning."""), + 'module_sale_margin': fields.boolean("Display Margins For Users", + help="""This adds the 'Margin' on sales order. + This gives the profitability by calculating the difference between the Unit Price and Cost Price. + This installs the module sale_margin."""), + 'module_sale_journal': fields.boolean("Invoice Journal", + help="""Allows you to categorize your sales and deliveries (picking lists) between different journals. + This installs the module sale_journal."""), + 'module_analytic_user_function': fields.boolean("User function by contracts", + help="""Allows you to define what is the default function of a specific user on a given account. + This is mostly used when a user encodes his timesheet. The values are retrieved and the fields are auto-filled. + But the possibility to change these values is still available. + This installs the module analytic_user_function."""), + 'module_analytic_journal_billing_rate': fields.boolean("Billing rates by contracts", + help="""Allows you to define the default invoicing rate for a specific journal on a given account. + This installs the module analytic_journal_billing_rate."""), + 'tax_policy': fields.selection( + [('no_tax', 'No Tax'), ('global_on_order', 'Global On Order'), ('on_order_line', 'On Order Lines')], + 'Taxes', required=True, + help="""Choose between either applying global taxes on a sale order, or applying different taxes on sale order lines, or applying no tax at all.""") + 'group_sale_taxes_global_on_order': fields.boolean("Global on order", + implied_group='sale.group_taxes_global_on_order'), + 'group_sale_taxes_on_order_line': fields.boolean("On order line", + implied_group='sale.group_taxes_on_order_line'), + 'module_project_timesheet': fields.boolean("Project Timesheet"), + 'module_project_mrp': fields.boolean("Project MRP"), + } + + def default_get(self, cr, uid, fields, context=None): + ir_model_data = self.pool.get('ir.model.data') + res = super(sale_configuration, self).default_get(cr, uid, fields, context) + # task_work, time_unit and tax_policy depend on other fields + res['task_work'] = res.get('module_project_mrp') and res.get('module_project_timesheet') + if res.get('module_account_analytic_analysis'): + product = ir_model_data.get_object(cr, uid, 'product', 'product_consultant') + res['time_unit'] = product.uom_id.id + res['tax_policy'] = \ + (res.get('group_sale_taxes_global_on_order') and 'global_on_order') or \ + (res.get('group_sale_taxes_on_order_line') and 'on_order_line') or \ + 'no_tax' + return res + + def get_default_sale_config(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + default_picking_policy = ir_values.get_default(cr, uid, 'sale.order', 'picking_policy') + return { + 'default_picking_policy': default_picking_policy == 'one', + } + + def _get_default_time_unit(self, cr, uid, context=None): + ids = self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=context) + return ids and ids[0] or False + + _defaults = { + 'default_order_policy': 'manual', + 'time_unit': _get_default_time_unit, + 'tax_policy': 'global_on_order', + } + + def set_sale_defaults(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + ir_model_data = self.pool.get('ir.model.data') + wizard = self.browse(cr, uid, ids)[0] + + default_picking_policy = 'one' if wizard.default_picking_policy else 'direct' + ir_values.set_default(cr, uid, 'sale.order', 'picking_policy', default_picking_policy) + + if wizard.time_unit: + product = ir_model_data.get_object(cr, uid, 'product', 'product_consultant') + product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id}) + + if wizard.task_work and wizard.time_unit: + user = self.pool.get('res.users').browse(cr, uid, uid, context) + user.company_id.write({'project_time_mode_id': wizard.time_unit.id}) + + return {} + + def onchange_task_work(self, cr, uid, ids, task_work, context=None): + return {'value': { + 'module_project_timesheet': task_work, + 'module_project_mrp': task_work, + }} + + def onchange_tax_policy(self, cr, uid, ids, tax_policy, context=None): + return {'value': { + 'group_sale_taxes_global_on_order': tax_policy == 'global_on_order', + 'group_sale_taxes_on_order_line': tax_policy == 'on_order_line', + }} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml new file mode 100644 index 00000000000..ab3d34a7096 --- /dev/null +++ b/addons/sale/res_config_view.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="view_sales_config" model="ir.ui.view"> + <field name="name">Sales Application</field> + <field name="model">sale.config.settings</field> + <field name="type">form</field> + <field name="inherit_id" ref="base.view_sale_config_settings"/> + <field name="arch" type="xml"> + <group name="config_sale" position="inside"> + <separator string="Picking and Invoice Policy" colspan="4"/> + <group colspan="4"> + <group colspan="2" col="2"> + <field name="group_invoice_so_lines"/> + <field name="group_invoice_deli_orders"/> + <field name="task_work" on_change="onchange_task_work(task_work)"/> + <field name="module_project_timesheet" invisible="1"/> + <field name="module_project_mrp" invisible="1"/> + <field name="module_account_analytic_analysis"/> + </group> + <group colspan="2" col="2"> + <field name="default_order_policy" attrs="{'invisible':['|',('group_invoice_so_lines','=',False),('group_invoice_deli_orders','=',False)]}"/> + <field name="module_delivery" attrs="{'invisible':[('group_invoice_so_lines','=',False), ('group_invoice_deli_orders','=',False)]}"/> + <field name="default_picking_policy" attrs="{'invisible':[('group_invoice_deli_orders','=',False)]}"/> + <field name="time_unit" domain="[('category_id.name','=','Working Time')]" attrs="{'invisible':[('task_work','=',False),('module_account_analytic_analysis','=',False)],'required': [('module_account_analytic_analysis','=',True)]}"/> + </group> + </group> + <separator string="Sale Order" colspan="4"/> + <group colspan="2" col="2"> + <field name="group_sale_pricelist"/> + <field name="tax_policy" on_change="onchange_tax_policy(tax_policy)"/> + <field name="group_sale_taxes_global_on_order" invisible="1"/> + <field name="group_sale_taxes_on_order_line" invisible="1"/> + <field name="module_sale_margin"/> + <field name="module_warning"/> + </group> + <group colspan="2" col="2"> + <field name="group_sale_uom"/> + <field name="group_sale_delivery_address"/> + <field name="group_discount_per_so_line"/> + <field name="module_sale_layout"/> + <field name="module_sale_journal"/> + </group> + </group> + </field> + </record> + + <menuitem id="base.menu_sale_config" name="Sales & CRM" parent="base.menu_config" sequence="1" action="base.action_sale_config"/> + + </data> +</openerp> diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 82bfda7b580..f52c2112ac3 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1330,95 +1330,4 @@ class sale_order_line(osv.osv): sale_order_line() -class sale_config_picking_policy(osv.osv_memory): - _name = 'sale.config.picking_policy' - _inherit = 'res.config' - - _columns = { - 'name': fields.char('Name', size=64), - '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','Main Working Time Unit') - } - _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 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 execute(self, cr, uid, ids, 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') - module_obj = self.pool.get('ir.module.module') - module_upgrade_obj = self.pool.get('base.module.upgrade') - 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.task_work: - module_name.append('project_timesheet') - module_name.append('project_mrp') - module_name.append('account_analytic_analysis') - - if wizard.timesheet: - module_name.append('account_analytic_analysis') - - if wizard.charge_delivery: - module_name.append('delivery') - - if len(module_name): - module_ids = [] - need_install = False - module_ids = [] - for module in module_name: - data_id = module_obj.name_search(cr, uid , module, [], '=') - module_ids.append(data_id[0][0]) - - for module in module_obj.browse(cr, uid, module_ids): - if module.state == 'uninstalled': - module_obj.state_update(cr, uid, [module.id], 'to install', ['uninstalled'], context) - need_install = True - cr.commit() - if need_install: - pooler.restart_pool(cr.dbname, update_module=True)[1] - - 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) - -sale_config_picking_policy() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 90d3838f5a0..be15820da71 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -21,7 +21,7 @@ <field name="company_id" widget="selection" groups="base.group_multi_company"/> <separator colspan="4" string="Accounting"/> <field name="payment_default_id"/> - <field domain="[('type','=','sale')]" name="pricelist_id" select="1"/> + <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" select="1"/> <field name="project_id" select="1" groups="analytic.group_analytic_accounting"/> </form> </field> @@ -34,7 +34,7 @@ <tree string="Sales Shop"> <field name="name"/> <field name="warehouse_id"/> - <field name="pricelist_id"/> + <field name="pricelist_id" groups="product.group_sale_pricelist"/> <field name="project_id" groups="analytic.group_analytic_accounting"/> </tree> </field> @@ -117,9 +117,9 @@ <page string="Sales Order"> <field name="partner_id" options='{"quick_create": false}' on_change="onchange_partner_id(partner_id)" domain="[('customer','=',True)]" context="{'search_default_customer':1}" required="1"/> <field domain="[('partner_id','=',partner_id)]" name="partner_order_id" on_change="onchange_partner_order_id(partner_order_id, partner_invoice_id, partner_shipping_id)" options='{"quick_create": false}'/> - <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" groups="base.group_extended" options='{"quick_create": false}'/> - <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id" groups="base.group_extended" options='{"quick_create": false}'/> - <field domain="[('type','=','sale')]" name="pricelist_id" groups="base.group_extended" on_change="onchange_pricelist_id(pricelist_id,order_line)"/> + <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" groups="group_delivery_invoice_address" options='{"quick_create": false}'/> + <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id" groups="group_delivery_invoice_address" options='{"quick_create": false}'/> + <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/> <field name="project_id" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/> <newline/> <field colspan="4" name="order_line" nolabel="1" widget="one2many_list"> @@ -139,7 +139,7 @@ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/> <field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)" - nolabel="1"/> + nolabel="1" groups="product.group_uom"/> <field name="price_unit"/> <field groups="product.group_uos" name="product_uos_qty"/> @@ -149,11 +149,12 @@ context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="base.group_extended" colspan="3"/> - <field name="discount"/> - <separator colspan="5" string="Notes"/> - <field colspan="5" name="notes" nolabel="1"/> - <separator colspan="5" string="Taxes"/> - <field colspan="5" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/> + <field name="discount" groups="group_discount_per_so_line"/> + <separator colspan="5" string="Notes" groups="base.group_sale_notes_subtotal"/> + <field colspan="5" name="notes" nolabel="1" groups="base.group_sale_notes_subtotal"/> + <separator colspan="5" string="Taxes" groups="group_taxes_on_order_line"/> + <field colspan="5" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]" + groups="group_taxes_on_order_line" /> <group colspan="5" col="5" groups="base.group_extended"> <separator colspan="5" string="States"/> <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/> @@ -183,18 +184,19 @@ <tree string="Sales Order Lines"> <field colspan="4" name="name"/> <field name="product_uom_qty" string="Qty(UoM)"/> - <field name="product_uom" string="UoM"/> + <field name="product_uom" string="UoM" groups="product.group_uom"/> <field groups="product.group_uos" name="product_uos_qty" string="Qty(UoS)"/> <field groups="product.group_uos" name="product_uos" string="UoS"/> - <field name="discount"/> + <field name="discount" groups="group_discount_per_so_line"/> <field name="price_unit"/> - <field name="price_subtotal"/> + <field name="price_subtotal" groups="base.group_sale_notes_subtotal"/> </tree> </field> <newline/> <group col="13" colspan="10"> - <field name="amount_untaxed" sum="Untaxed amount"/> - <field name="amount_tax"/> + <field name="tax_id" groups="group_taxes_global_on_order" on_change="onchange_taxes(tax_id)"/> + <field name="amount_untaxed" sum="Untaxed amount" groups="group_taxes_on_order_line,group_taxes_global_on_order"/> + <field name="amount_tax" groups="group_taxes_on_order_line,group_taxes_global_on_order"/> <field name="amount_total"/> <button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/> <button name="%(action_view_sale_advance_payment_inv)d" string="Advance Invoice" type="action" icon="gtk-execute" states="draft,manual" groups="base.group_extended"/> @@ -240,8 +242,8 @@ <field name="create_date"/> <field name="date_confirm"/> </group> - <separator colspan="4" string="Notes"/> - <field colspan="4" name="note" nolabel="1"/> + <separator colspan="4" string="Notes" groups="base.group_sale_notes_subtotal"/> + <field colspan="4" name="note" nolabel="1" groups="base.group_sale_notes_subtotal"/> </page> <page string="History" groups="base.group_extended"> <separator colspan="4" string="Invoices"/> @@ -361,9 +363,9 @@ <field name="order_partner_id"/> <field name="product_id"/> <field name="product_uom_qty" string="Qty"/> - <field name="product_uom" string="UoM"/> + <field name="product_uom" string="UoM" groups="product.group_uom"/> <field name="salesman_id"/> - <field name="price_subtotal" sum="Total"/> + <field name="price_subtotal" sum="Total" groups="base.group_sale_notes_subtotal"/> <field name="state"/> <field name="invoiced"/> </tree> @@ -382,7 +384,7 @@ <field name="product_id" readonly="1"/> <field name="product_uom_qty" readonly="1"/> - <field name="product_uom"/> + <field name="product_uom" groups="product.group_uom"/> <field colspan="4" name="name" groups="base.group_extended"/> <field name="company_id" groups="base.group_multi_company" readonly="1"/> @@ -390,11 +392,11 @@ <separator colspan="4" string="Price"/> <group colspan="4" col="6"> <field name="price_unit"/> - <field name="discount"/> - <field name="price_subtotal"/> + <field name="discount" groups="group_discount_per_so_line"/> + <field name="price_subtotal" groups="base.group_sale_notes_subtotal"/> </group> - <separator colspan="4" string="Notes"/> - <field colspan="4" name="notes" nolabel="1"/> + <separator colspan="4" string="Notes" groups="base.group_sale_notes_subtotal"/> + <field colspan="4" name="notes" nolabel="1" groups="base.group_sale_notes_subtotal"/> <separator colspan="4"/> <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/> <group col="3" colspan="2"> @@ -499,69 +501,7 @@ groups="base.group_sale_salesman"/> <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" model="ir.ui.view"> - <field name="name">Setup Your Invoicing Method</field> - <field name="model">sale.config.picking_policy</field> - <field name="type">form</field> - <field name="inherit_id" ref="base.res_config_view_base"/> - <field name="arch" type="xml"> - <data> - <form position="attributes"> - <attribute name="string">Setup your Invoicing Method</attribute> - </form> - - <xpath expr="//separator[@string="title"]" position="attributes"> - <attribute name="string">Setup your Invoicing Method</attribute> - </xpath> - <xpath expr="//label[@string='description']" position="attributes"> - <attribute name="string">This tool will help you to install the right module and configure the system according to the method you use to invoice your customers.</attribute> - </xpath> - <xpath expr="//separator[@string="vsep"]" position="attributes"> - <attribute name="string"/> - <attribute name="rowspan">12</attribute> - </xpath> - <group string="res_config_contents" position="replace"> - <group colspan="4" col="4"> - <field name="sale_orders" on_change="onchange_order(sale_orders,deli_orders)"/> - <newline/> - <field name="deli_orders" on_change="onchange_order(sale_orders,deli_orders)"/> - <newline/> - <field name="task_work"/> - <newline/> - <field name="timesheet"/> - <newline/> - <separator string="Options" colspan="4"/> - <field name="order_policy" attrs="{'invisible':['|',('sale_orders','!=',True),('deli_orders','!=',True)]}"/> - <newline/> - <field name="charge_delivery" attrs="{'invisible':[('sale_orders','!=',True), ('deli_orders','!=',True)]}"/> - <newline/> - <field name="time_unit" widget="selection" domain="[('category_id','=',%(product.uom_categ_wtime)s)]" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)]}"/> - </group> - </group> - </data> - </field> - </record> - - <record id="action_config_picking_policy" model="ir.actions.act_window"> - <field name="name">Setup your Invoicing Method</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">sale.config.picking_policy</field> - <field name="view_id" ref="view_config_picking_policy"/> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - - <!-- register configuration wizard --> - <record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo"> - <field name="action_id" ref="action_config_picking_policy"/> - <field name="category_id" ref="base.category_sales_management_config"/> - <field name="type">once</field> - </record> + <menuitem id="menu_invoicing_sales_order_lines" parent="base.menu_invoiced" action="action_order_line_tree2" sequence="2" groups="group_invoice_so_lines"/> </data> </openerp> diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index ae8c8bf62e3..ee45aa65463 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -20,6 +20,36 @@ <field name="users" eval="[(4, ref('base.user_root'))]"/> </record> + <record id="group_invoice_so_lines" model="res.groups"> + <field name="name">Enable Invoicing Sale order lines</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_invoice_deli_orders" model="res.groups"> + <field name="name">Enable Invoicing Delivery orders</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_delivery_invoice_address" model="res.groups"> + <field name="name">Addresses in Sale Orders</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_discount_per_so_line" model="res.groups"> + <field name="name">Discount on lines</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_taxes_global_on_order" model="res.groups"> + <field name="name">Sales Taxes Global on Order</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + + <record id="group_taxes_on_order_line" model="res.groups"> + <field name="name">Sales Taxes on Order Lines</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + <record model="res.users" id="base.user_admin"> <field eval="[(4,ref('base.group_partner_manager'))]" name="groups_id"/> </record> diff --git a/addons/sale/stock_view.xml b/addons/sale/stock_view.xml index 7b9e90f6f0a..fdc7b29acc8 100644 --- a/addons/sale/stock_view.xml +++ b/addons/sale/stock_view.xml @@ -74,7 +74,7 @@ <field name="context">{'default_type': 'out', 'contact_display': 'partner_address', 'search_default_to_invoice': 1, 'search_default_done': 1}</field> <field name="search_view_id" ref="stock.view_picking_out_search"/> </record> - <menuitem action="outgoing_picking_list_to_invoice" id="menu_action_picking_list_to_invoice" parent="base.menu_invoiced" groups="base.group_no_one" sequence="20"/> + <menuitem action="outgoing_picking_list_to_invoice" id="menu_action_picking_list_to_invoice" parent="base.menu_invoiced" groups="group_invoice_deli_orders" sequence="20"/> </data> </openerp> diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index d997e792696..bb197763486 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.config.picking_policy, id: sale.config.picking_policy_0}: - order_policy: 'manual' + !record {model: sale.config.settings, id: sale_configuration_0}: + default_order_policy: 'manual' - - !python {model: sale.config.picking_policy}: | - self.execute(cr, uid, [ref("sale.config.picking_policy_0")]) + !python {model: sale.config.settings}: | + self.execute(cr, uid, [ref("sale_configuration_0")], context=context) diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index 78f98d3002f..146ca8aa006 100644 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -37,6 +37,7 @@ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/> <field name="product_uom" nolabel="1" + groups="product.group_uom" required="0" attrs="{'invisible':[('layout_type','!=','article')], 'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}" on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"/> @@ -99,7 +100,7 @@ <tree string="Sales order lines"> <field colspan="4" name="name"/> <field name="product_uom_qty" string="Qty"/> - <field name="product_uom" string="UoM"/> + <field name="product_uom" string="UoM" groups="product.group_uom"/> <field name="discount"/> <field name="price_unit"/> <!-- field name="price_net"/--> |
