diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 1296d5c718a..393c468c952 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -196,7 +196,7 @@ - + @@ -344,7 +344,22 @@ - + + + + + + + + + + + + +
diff --git a/addons/account_accountant/account_accountant_data.xml b/addons/account_accountant/account_accountant_data.xml index 3d665e680c3..7724dcb6774 100644 --- a/addons/account_accountant/account_accountant_data.xml +++ b/addons/account_accountant/account_accountant_data.xml @@ -1,20 +1,23 @@ - Accounting + - - + + + + + + Module Accounting and Finance has been installed + From the top menu Accounting, manage all of your accounting: + general accounting, cost/analytic accounting, third party + accounting, taxes, budgets, customer and supplier invoices, + bank statements, reconciliation process. + + diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index 48e8013fd43..0b37bdbd4a2 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -38,7 +38,9 @@ eInvoicing & Payments module manage all Voucher Entries such as "Reconciliation "website" : "http://tinyerp.com", "images" : ["images/customer_payment.jpeg","images/journal_voucher.jpeg","images/sales_receipt.jpeg","images/supplier_voucher.jpeg"], "depends" : ["account"], - "init_xml" : [], + "init_xml" : [ + 'account_voucher_data.xml', + ], "demo_xml" : [], diff --git a/addons/account_voucher/account_voucher_data.xml b/addons/account_voucher/account_voucher_data.xml new file mode 100644 index 00000000000..8f1cf30ae2f --- /dev/null +++ b/addons/account_voucher/account_voucher_data.xml @@ -0,0 +1,19 @@ + + + + + + + + Module eInvoicing & Payments has been installed + From the top menu Invoicing, manage your customer and supplier + invoices. You can also manage refunds, receipts and register + payments. + + In order to manage all accounting features (journal items, + chart of accounts, etc), you should install the module + "Accounting and Finance". + + + + diff --git a/addons/base_setup/__openerp__.py b/addons/base_setup/__openerp__.py index 35505ea853f..1ebc708959e 100644 --- a/addons/base_setup/__openerp__.py +++ b/addons/base_setup/__openerp__.py @@ -33,13 +33,18 @@ Shows you a list of applications features to install from. """, 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', - 'depends': ['base'], - 'init_xml': [], - 'update_xml': ['security/ir.model.access.csv', 'base_setup_views.xml', 'res_config_view.xml'], - 'demo_xml': [], + 'depends': ['base', 'web_kanban'], + 'data': [ + 'security/ir.model.access.csv', + 'base_setup_views.xml', + 'res_config_view.xml', + 'res_partner_view.xml', + ], + 'demo': [], 'installable': True, 'auto_install': False, 'certificate': '0086711085869', 'images': ['images/base_setup1.jpeg','images/base_setup2.jpeg','images/base_setup3.jpeg','images/base_setup4.jpeg',], + 'js': ['static/src/js/base_setup.js'], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_setup/res_partner_view.xml b/addons/base_setup/res_partner_view.xml new file mode 100644 index 00000000000..9a19a7e4666 --- /dev/null +++ b/addons/base_setup/res_partner_view.xml @@ -0,0 +1,19 @@ + + + + + + res.partner.kanban.inherit + res.partner + + + + + + + + + + + + diff --git a/addons/base_setup/static/src/js/base_setup.js b/addons/base_setup/static/src/js/base_setup.js new file mode 100644 index 00000000000..4f900a3d69b --- /dev/null +++ b/addons/base_setup/static/src/js/base_setup.js @@ -0,0 +1,24 @@ +openerp.base_setup = function(openerp) { + /* extend kanban to include the names of partner categories in the kanban view of partners */ + openerp.web_kanban.KanbanView.include({ + on_groups_started: function() { + var self = this; + self._super.apply(this, arguments); + if (this.dataset.model === 'res.partner') { + /* Set names for partner categories */ + var category_ids = []; + this.$element.find('.oe_kanban_partner_categories span').each(function() { + category_ids.push($(this).data('category_id')); + }); + var dataset = new openerp.web.DataSetSearch(this, 'res.partner.category', self.session.context); + dataset.name_get(_.uniq(category_ids)).then(function(result) { + _.each(result, function(value) { + self.$element + .find('.oe_kanban_partner_categories span[data-category_id=' + value[0] + ']') + .html(value[1]); + }); + }); + } + } + }); +}; diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index 4ca40a691f5..88179428ab5 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -17,5 +17,27 @@ Sales Department Sales + + + + + + Module CRM has been installed + From the top menu Sales, manage your sales pipeline: leads, + opportunities, meetings, phone calls, and customers. OpenERP + ensures that all cases are successfully tracked by all parties. + It can automatically send reminders, escalate requests, trigger + specific methods and lots of other actions based on your own + enterprise rules. + + In the Sales settings, you can configure an email gateway to + automatically create leads from messages sent on a particular + email address. + + To manage quotations and sale orders, install the module "Sales + Management". With this module, you will be able to create + quotations directly from opportunities. + + diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 00adcc2185d..1350fa11f16 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -106,16 +106,17 @@ res.partner kanban + - - + + Opportunities - + Meetings diff --git a/addons/event/event_data.xml b/addons/event/event_data.xml new file mode 100644 index 00000000000..b34f9451f71 --- /dev/null +++ b/addons/event/event_data.xml @@ -0,0 +1,15 @@ + + + + + + + + Module Events Organisation has been installed + Organize events and manage their registrations. You can + automatically confirm and send acknowledgements of registrations + by email. + + + + diff --git a/addons/hr/hr_data.xml b/addons/hr/hr_data.xml index adb6efbd1d7..d8c9251c62e 100644 --- a/addons/hr/hr_data.xml +++ b/addons/hr/hr_data.xml @@ -1,6 +1,23 @@ + + + + + Module Employee Directory has been installed + Manage your human resources in OpenERP: employees and hierarchy, + HR departments and jobs. + + More features are available in the following modules: + Recruitment Process (manage job positions and recruitment), + Timesheets Validation (record timesheets and attendance), + Leaves Management (keep track of employee leaves), + Expenses Management (manage employee expenses), + Employee Appraisals (organize employee surveys, where employees + evaluate their subordinates or their manager.) + + Administrator diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml index bf482d2fcd7..6cd10f2d07a 100644 --- a/addons/hr_evaluation/hr_evaluation_data.xml +++ b/addons/hr_evaluation/hr_evaluation_data.xml @@ -1,6 +1,18 @@ + + + + + Module Employee Appraisals has been installed + Create evaluations for your subordinates or manager. You can + define a plan with several surveys, where you organize evaluation + surveys related to the hierarchy levels. Evaluations filled by + employees can exported as pdf files. + + + Self Appraisal 20 diff --git a/addons/hr_expense/hr_expense_data.xml b/addons/hr_expense/hr_expense_data.xml index 0e940c74cc0..82e9e9574b5 100644 --- a/addons/hr_expense/hr_expense_data.xml +++ b/addons/hr_expense/hr_expense_data.xml @@ -1,10 +1,23 @@ - - + + + + + Module Expenses Management has been installed + Manage your employee's expenses, with validations by employee + manager and accountant, creation and payment of invoice. + + This module also uses the analytic accounting and is compatible + with the invoice on timesheet module so that you will be able to + automatically re-invoice your customer's expenses if your work + by project. + + + + + Expenses diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index c5045d7b318..d41d72779cf 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -1,34 +1,44 @@ - + + + + + + Module Leaves Management has been installed + Manage employee leaves from the top menu "Human Resources." + Employees can create leave requests that are validated by their + manager and/or HR people. Once validated, they are visible in + the employee's calendar. HR people can define leave types and + allocate off-days for employees. + + - - - - black - + + + + black + - - - Sick Leaves - True - red - + + + Sick Leaves + True + red + + + + Compensatory Days + True + lavender + - - - Compensatory Days - True - lavender - - - - - Unpaid - True - brown - - - + + + Unpaid + True + brown + + diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 6b64964eb2a..2250445f871 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -1,6 +1,20 @@ + + + + + Module Recruitment Process has been installed + + Manage job positions and the recruitment process in your company. + This module is integrated with the module Survey to help you to + define interviews for different jobs. + + You can automatically create application records from an email + gateway, that you can configure in the Human Resources Settings. + + diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml index e66694223d2..c5839f886d3 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml @@ -1,6 +1,15 @@ + + + + + Module Timesheets Validation has been installed + From the top menu "Human Resources", encode and validate + timesheets and attendances. + + diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml index 11c259b3ee8..15928cd3e26 100644 --- a/addons/mail/data/mail_group_data.xml +++ b/addons/mail/data/mail_group_data.xml @@ -14,5 +14,16 @@ + + + + + Module Social Network has been installed + Manage all communications on your documents (emails, + notifications, comments and discussions) and keep track of + news on documents you follow. + + + diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index d036150b21c..1655ab98afb 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -822,8 +822,6 @@ class mail_thread(osv.Model): def message_append_note(self, cr, uid, ids, subject=None, body=None, parent_id=False, type='notification', content_subtype='html', context=None): - if type in ['notification', 'comment']: - subject = None if content_subtype == 'html': body_html = body body_text = body diff --git a/addons/mrp/mrp_data.xml b/addons/mrp/mrp_data.xml index 64dd9f2c9e5..7e98554a2ed 100644 --- a/addons/mrp/mrp_data.xml +++ b/addons/mrp/mrp_data.xml @@ -1,6 +1,20 @@ + + + + + Module MRP has been installed + Manage your manufacturing process in OpenERP by defining bill + of materials (BoM), routings and work centers. This module + supports complete integration and planification of stockable + goods, consumable, and services. + + From the Manufacturing Settings, you can choose to compute + production schedules periodically or just-in-time. + + Production order diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml index 234e61ff394..49e64569f6a 100644 --- a/addons/point_of_sale/point_of_sale_data.xml +++ b/addons/point_of_sale/point_of_sale_data.xml @@ -1,12 +1,26 @@ - - Main PoS + + + + + + + Module Point of Sale has been installed + Encode sale orders, register payments, compute money to return, + create invoices, and manage refunds of former sales through a + specific, web-based, user interface. + + Simply click on the top menu "Point of Sale" to launch its + interface. You can configure your point of sale and perform + backend operations in the menu "PoS Backend". + + diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 4c95373d91f..966b1c49f74 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -59,5 +59,21 @@ + + + + + + Module Project Management has been installed + Manage multi-level projects and tasks. You can delegate tasks, + track the work done on tasks, and review your planning based on + the entered data. + + You can manage todo lists on tasks by installing the module + "Todo Lists", which supports the methodology Getting Things + Done (GTD). You can also manage issues/bugs in projects by + installing the module "Issues Tracker." + + diff --git a/addons/project_gtd/project_gtd_data.xml b/addons/project_gtd/project_gtd_data.xml index 7d495023f87..38cc247fc32 100644 --- a/addons/project_gtd/project_gtd_data.xml +++ b/addons/project_gtd/project_gtd_data.xml @@ -22,6 +22,20 @@ Long Term terp-project + + + + + + + Module Todo Lists has been installed + + Add todo items on project tasks, to help you organize your work. + This module supports the methodology Getting Things Done (GTD), + created by David Allen, and described in the book of the same + name. + + diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index 34fea22f9b9..add2ce99c19 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -31,5 +31,19 @@ v3.0 + + + + + Module Issues Tracker has been installed + Manage the issues you might face in a project, like bugs in a + system, client complaints or material breakdowns. You can + record issues, assign them to some responsible person, and keep + track of their status as they evolve over time. + + You can access issues from the top menu Project, and access the + issues of a specific project from the projects gallery view. + + diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index 2b57a2a75bc..9d7399abab0 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -1,6 +1,19 @@ + + + + + Module Purchase Management has been installed + From the top menu Purchases, create purchase orders to buy + products from your suppliers, encode supplier invoices and + manage your payments. + + You can also manage purchase requisitions, see the Purchase + Settings. + + Purchase Order diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index d43bc75be7a..45c01c582a0 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -69,6 +69,9 @@ class sale_configuration(osv.osv_memory): 'group_sale_delivery_address': fields.boolean("Allow Different Addresses for Delivery and Invoice", implied_group='sale.group_delivery_invoice_address', help="Allows you to specify different delivery and invoice addresses on a sale order."), + 'group_mrp_properties': fields.boolean('Properties on Lines', + implied_group='sale.group_mrp_properties', + help="Allows you to tag sale order lines with properties."), 'group_discount_per_so_line': fields.boolean("Discount per Line", implied_group='sale.group_discount_per_so_line', help="Allows you to apply some discount per sale order line."), diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml index d4b045a2775..ee05a6d2d26 100644 --- a/addons/sale/res_config_view.xml +++ b/addons/sale/res_config_view.xml @@ -20,6 +20,7 @@ + diff --git a/addons/sale/res_partner_view.xml b/addons/sale/res_partner_view.xml index 11ac318b7a7..76f6f3ad816 100644 --- a/addons/sale/res_partner_view.xml +++ b/addons/sale/res_partner_view.xml @@ -24,12 +24,13 @@ res.partner kanban + - - + + Sales diff --git a/addons/sale/sale.py b/addons/sale/sale.py index aeede7e5533..f920b34ca42 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -483,19 +483,19 @@ class sale_order(osv.osv): return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order', 'datas': datas, 'nodestroy': True} def manual_invoice(self, cr, uid, ids, context=None): + """ create invoices for the given sale orders (ids), and open the form + view of one of the newly created invoices + """ mod_obj = self.pool.get('ir.model.data') wf_service = netsvc.LocalService("workflow") - inv_ids = set() - inv_ids1 = set() - for id in ids: - for record in self.pool.get('sale.order').browse(cr, uid, id).invoice_ids: - inv_ids.add(record.id) - # inv_ids would have old invoices if any + + # create invoices through the sale orders' workflow + inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids) for id in ids: wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr) - for record in self.pool.get('sale.order').browse(cr, uid, id).invoice_ids: - inv_ids1.add(record.id) - inv_ids = list(inv_ids1.difference(inv_ids)) + inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids) + # determine newly created invoices + new_inv_ids = list(inv_ids1 - inv_ids0) res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') res_id = res and res[1] or False, @@ -510,7 +510,7 @@ class sale_order(osv.osv): 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', - 'res_id': inv_ids and inv_ids[0] or False, + 'res_id': new_inv_ids and new_inv_ids[0] or False, } def action_view_invoice(self, cr, uid, ids, context=None): diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml index 9768f606793..c93651219af 100644 --- a/addons/sale/sale_data.xml +++ b/addons/sale/sale_data.xml @@ -1,17 +1,13 @@ - + Sales Order sale.order - + @@ -26,29 +22,19 @@ - - - - - Module sale installed! - comment - text - res.users - - Welcome to OpenERP - - You can click on the top menu Sales to manage your - customers, your quotations and sales orders. - - If you need to manage your sales pipeline (leads, - opportunities, phonecalls), you can install the CRM module - from the Settings top menu. - - - - - - + + + + + Module Sales Management has been installed + From the top menu Sales, manage your customers, quotations and + sales orders. With sale orders, you can manage product + deliveries and customer invoices. + If you need to manage your sales pipeline (leads, opportunities, + phonecalls), you can install the module CRM from the top menu + Settings. + + diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 9d368563e3c..ac665df7a6b 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -157,7 +157,6 @@
- - - + + + + + + + + + - - - - + + + + @@ -456,7 +469,7 @@ - + diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index 0cb55fb0d30..47a577e77c3 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -35,6 +35,11 @@ + + Properties on lines + + + Discount on lines diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index bb197763486..505ab0933d0 100644 --- a/addons/sale/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -16,7 +16,7 @@ ctx = context.copy() ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")}) order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("line7"), context=context) - pay_id = self.create(cr, uid, {'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty}) + pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty}) self.create_invoices(cr, uid, [pay_id], context=ctx) - I check Invoice which made advance diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 08f67106870..39999a8d1b7 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -26,189 +26,198 @@ class sale_advance_payment_inv(osv.osv_memory): _name = "sale.advance.payment.inv" _description = "Sales Advance Payment Invoice" - def _default_product_id(self, cr, uid, context=None): - try: - product_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'advance_product_0') - except ValueError: - #a ValueError is returned if the xml id given is not found in the table ir_model_data - return False - return product_id[1] - _columns = { - 'product_id': fields.many2one('product.product', 'Advance Product', help="Select a product of type service which is called 'Advance Product'. You may have to create it and set it as a default value on this field."), - 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Sale Price'), required=True, help="The amount to be invoiced in advance."), + 'advance_payment_method':fields.selection( + [('all', 'All'), ('percentage','Percentage'), ('fixed','Fixed Price'), + ('lines', 'Some Order Lines')], + 'Type', required=True, + help="""Use All to create the final invoice. + Use Percentage to invoice a percentage of the total amount. + Use Fixed Price to invoice a specific amound in advance. + Use Some Order Lines to invoice a selection of the sale order lines."""), 'qtty': fields.float('Quantity', digits=(16, 2), required=True), - 'advance_payment_method':fields.selection([('percentage','Percentage'), ('fixed','Fixed Price')], 'Type', required=True, help="Use Fixed Price if you want to give specific amount in Advance. Use Percentage if you want to give percentage of Total Invoice Amount."), + 'product_id': fields.many2one('product.product', 'Advance Product', + help="""Select a product of type service which is called 'Advance Product'. + You may have to create it and set it as a default value on this field."""), + 'amount': fields.float('Advance Amount', digits_compute= dp.get_precision('Sale Price'), + help="The amount to be invoiced in advance."), } + def _get_advance_product(self, cr, uid, context=None): + try: + product = self.pool.get('ir.model.data').get_object(cr, uid, 'sale', 'advance_product_0') + except ValueError: + # a ValueError is returned if the xml id given is not found in the table ir_model_data + return False + return product.id + _defaults = { + 'advance_payment_method': 'all', 'qtty': 1.0, - 'advance_payment_method': 'fixed', - 'product_id': _default_product_id, + 'product_id': _get_advance_product, } - def onchange_advance_payment_method(self, cr, uid, ids, advance_payment_method, product_id, context=None): + def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None): if advance_payment_method == 'percentage': return {'value': {'amount':0, 'product_id':False }} - if not product_id: - return {'value': {'amount': 0}} - product = self.pool.get('product.product').browse(cr, uid, product_id, context=context) - return {'value': {'amount': product.list_price}} - + if product_id: + product = self.pool.get('product.product').browse(cr, uid, product_id, context=context) + return {'value': {'amount': product.list_price}} + return {'value': {'amount': 0}} def create_invoices(self, cr, uid, ids, context=None): - """ - To create invoices. - - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param ids: the ID or list of IDs if we want more than one - @param context: A standard dictionary - - @return: - - """ - list_inv = [] - obj_sale = self.pool.get('sale.order') - obj_lines = self.pool.get('account.invoice.line') - inv_obj = self.pool.get('account.invoice') + """ create invoices for the active sale orders """ if context is None: context = {} + wizard = self.browse(cr, uid, ids[0], context) + sale_ids = context.get('active_ids', []) - for sale_adv_obj in self.browse(cr, uid, ids, context=context): - for sale in obj_sale.browse(cr, uid, context.get('active_ids', []), context=context): - create_ids = [] - ids_inv = [] - if sale.order_policy == 'postpaid': - raise osv.except_osv( - _('Error'), - _("You cannot make an advance on a sales order \ - that is defined as 'Automatic Invoice after delivery'.")) - val = obj_lines.product_id_change(cr, uid, [], sale_adv_obj.product_id.id, - uom = False, partner_id = sale.partner_id.id, fposition_id = sale.fiscal_position.id) - res = val['value'] + if wizard.advance_payment_method == 'all': + # create the final invoices of the active sale orders + res = self.pool.get('sale.order').manual_invoice(cr, uid, sale_ids, context) + if context.get('open_invoices', False): + return res + return {'type': 'ir.actions.act_window_close'} - if not sale_adv_obj.product_id.id : - prop = self.pool.get('ir.property').get(cr, uid, - 'property_account_income_categ', 'product.category', - context=context) - account_id = prop and prop.id or False - account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, sale.fiscal_position.id or False, account_id) - if not account_id: - raise osv.except_osv(_('Configuration Error !'), - _('There is no income account defined as global property.')) - res['account_id'] = account_id + if wizard.advance_payment_method == 'lines': + # open the list view of sale order lines to invoice + act_window = self.pool.get('ir.actions.act_window') + res = act_window.for_xml_id(cr, uid, 'sale', 'action_order_line_tree2', context) + res['context'] = { + 'search_default_uninvoiced': 1, + 'search_default_order_id': sale_ids and sale_ids[0] or False, + } + return res - if not res.get('account_id'): + assert wizard.advance_payment_method in ('fixed', 'percentage') + + sale_obj = self.pool.get('sale.order') + inv_obj = self.pool.get('account.invoice') + inv_line_obj = self.pool.get('account.invoice.line') + inv_ids = [] + + for sale in sale_obj.browse(cr, uid, sale_ids, context=context): + if sale.order_policy == 'postpaid': + raise osv.except_osv( + _('Error'), + _("You cannot make an advance on a sales order \ + that is defined as 'Automatic Invoice after delivery'.")) + + val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id, + uom=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) + res = val['value'] + + # determine and check income account + if not wizard.product_id.id : + prop = self.pool.get('ir.property').get(cr, uid, + 'property_account_income_categ', 'product.category', context=context) + prop_id = prop and prop.id or False + account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, sale.fiscal_position.id or False, prop_id) + if not account_id: raise osv.except_osv(_('Configuration Error !'), - _('There is no income account defined ' \ - 'for this product: "%s" (id:%d)') % \ - (sale_adv_obj.product_id.name, sale_adv_obj.product_id.id,)) + _('There is no income account defined as global property.')) + res['account_id'] = account_id + if not res.get('account_id'): + raise osv.except_osv(_('Configuration Error !'), + _('There is no income account defined for this product: "%s" (id:%d)') % \ + (wizard.product_id.name, wizard.product_id.id,)) - final_amount = 0 - if sale_adv_obj.amount <= 0.00: - raise osv.except_osv(_('Data Insufficient !'), - _('Please check the Advance Amount, it should not be 0 or less!')) - if sale_adv_obj.advance_payment_method == 'percentage': - final_amount = sale.amount_total * sale_adv_obj.amount / 100 - if not res.get('name'): - res['name'] = _("Advance of %s %%") % (sale_adv_obj.amount) - else: - final_amount = sale_adv_obj.amount - if not res.get('name'): - #TODO: should find a way to call formatLang() from rml_parse - if sale.pricelist_id.currency_id.position == 'after': - res['name'] = _("Advance of %s %s") % (final_amount, sale.pricelist_id.currency_id.symbol) - else: - res['name'] = _("Advance of %s %s") % (sale.pricelist_id.currency_id.symbol, final_amount) + # determine invoice amount + if wizard.amount <= 0.00: + raise osv.except_osv(_('Incorrect Data'), + _('The value of Advance Amount must be positive.')) + if wizard.advance_payment_method == 'percentage': + inv_amount = sale.amount_total * wizard.amount / 100 + if not res.get('name'): + res['name'] = _("Advance of %s %%") % (wizard.amount) + else: + inv_amount = wizard.amount + if not res.get('name'): + #TODO: should find a way to call formatLang() from rml_parse + symbol = sale.pricelist_id.currency_id.symbol + if sale.pricelist_id.currency_id.position == 'after': + res['name'] = _("Advance of %s %s") % (inv_amount, symbol) + else: + res['name'] = _("Advance of %s %s") % (symbol, inv_amount) - if res.get('invoice_line_tax_id'): - res['invoice_line_tax_id'] = [(6, 0, res.get('invoice_line_tax_id'))] - else: - res['invoice_line_tax_id'] = False + # determine taxes + if res.get('invoice_line_tax_id'): + res['invoice_line_tax_id'] = [(6, 0, res.get('invoice_line_tax_id'))] + else: + res['invoice_line_tax_id'] = False - line_id = obj_lines.create(cr, uid, { + # create the invoice + inv_line_values = { + 'name': res.get('name'), + 'account_id': res['account_id'], + 'price_unit': inv_amount, + 'quantity': wizard.qtty or 1.0, + 'discount': False, + 'uos_id': res.get('uos_id', False), + 'product_id': wizard.product_id.id, + 'invoice_line_tax_id': res.get('invoice_line_tax_id'), + 'account_analytic_id': sale.project_id.id or False, + } + inv_values = { + 'name': sale.client_order_ref or sale.name, + 'origin': sale.name, + 'type': 'out_invoice', + 'reference': False, + 'account_id': sale.partner_id.property_account_receivable.id, + 'partner_id': sale.partner_id.id, + 'invoice_line': [(0, 0, inv_line_values)], + 'currency_id': sale.pricelist_id.currency_id.id, + 'comment': '', + 'payment_term': sale.payment_term.id, + 'fiscal_position': sale.fiscal_position.id or sale.partner_id.property_account_position.id + } + inv_id = inv_obj.create(cr, uid, inv_values, context=context) + inv_obj.button_reset_taxes(cr, uid, [inv_id], context=context) + inv_ids.append(inv_id) + + # add the invoice to the sale order's invoices + sale.write({'invoice_ids': [(4, inv_id)]}) + + # If invoice on picking: add the cost on the SO + # If not, the advance will be deduced when generating the final invoice + if sale.order_policy == 'picking': + vals = { + 'order_id': sale.id, 'name': res.get('name'), - 'account_id': res['account_id'], - 'price_unit': final_amount, - 'quantity': sale_adv_obj.qtty or 1.0, + 'price_unit': -inv_amount, + 'product_uom_qty': wizard.qtty or 1.0, + 'product_uos_qty': wizard.qtty or 1.0, + 'product_uos': res.get('uos_id', False), + 'product_uom': res.get('uom_id', False), + 'product_id': wizard.product_id.id or False, 'discount': False, - 'uos_id': res.get('uos_id', False), - 'product_id': sale_adv_obj.product_id.id, - 'invoice_line_tax_id': res.get('invoice_line_tax_id'), - 'account_analytic_id': sale.project_id.id or False, - #'note':'', - }) - create_ids.append(line_id) - inv = { - 'name': sale.client_order_ref or sale.name, - 'origin': sale.name, - 'type': 'out_invoice', - 'reference': False, - 'account_id': sale.partner_id.property_account_receivable.id, - 'partner_id': sale.partner_id.id, - 'invoice_line': [(6, 0, create_ids)], - 'currency_id': sale.pricelist_id.currency_id.id, - 'comment': '', - 'payment_term': sale.payment_term.id, - 'fiscal_position': sale.fiscal_position.id or sale.partner_id.property_account_position.id + 'tax_id': res.get('invoice_line_tax_id'), } + self.pool.get('sale.order.line').create(cr, uid, vals, context=context) - inv_id = inv_obj.create(cr, uid, inv) - inv_obj.button_reset_taxes(cr, uid, [inv_id], context=context) - - for inv in sale.invoice_ids: - ids_inv.append(inv.id) - ids_inv.append(inv_id) - obj_sale.write(cr, uid, [sale.id], {'invoice_ids': [(6, 0, ids_inv)]}) - list_inv.append(inv_id) - # - # If invoice on picking: add the cost on the SO - # If not, the advance will be deduced when generating the final invoice - # - if sale.order_policy == 'picking': - vals = { - 'order_id': sale.id, - 'name': res.get('name'), - 'price_unit': -final_amount, - 'product_uom_qty': sale_adv_obj.qtty or 1.0, - 'product_uos_qty': sale_adv_obj.qtty or 1.0, - 'product_uos': res.get('uos_id', False), - 'product_uom': res.get('uom_id', False), - 'product_id': sale_adv_obj.product_id.id or False, - 'discount': False, - 'tax_id': res.get('invoice_line_tax_id'), - } - self.pool.get('sale.order.line').create(cr, uid, vals, context=context) - - context.update({'invoice_id':list_inv}) - - if context.get('open_invoices'): - return self.open_invoices( cr, uid, ids, context=context) + if context.get('open_invoices', False): + return self.open_invoices( cr, uid, ids, inv_ids, context=context) return {'type': 'ir.actions.act_window_close'} - def open_invoices(self, cr, uid, ids, context=None): - if context is None: - context = {} - mod_obj = self.pool.get('ir.model.data') - for advance_pay in self.browse(cr, uid, ids, context=context): - form_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') - form_id = form_res and form_res[1] or False - tree_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_tree') - tree_id = tree_res and tree_res[1] or False + def open_invoices(self, cr, uid, ids, invoice_ids, context=None): + """ open a view on one of the given invoice_ids """ + ir_model_data = self.pool.get('ir.model.data') + form_res = ir_model_data.get_object_reference(cr, uid, 'account', 'invoice_form') + form_id = form_res and form_res[1] or False + tree_res = ir_model_data.get_object_reference(cr, uid, 'account', 'invoice_tree') + tree_id = tree_res and tree_res[1] or False return { 'name': _('Advance Invoice'), 'view_type': 'form', 'view_mode': 'form,tree', 'res_model': 'account.invoice', - 'res_id': int(context['invoice_id'][0]), + 'res_id': invoice_ids[0], 'view_id': False, 'views': [(form_id, 'form'), (tree_id, 'tree')], 'context': "{'type': 'out_invoice'}", 'type': 'ir.actions.act_window', - } + } sale_advance_payment_inv() diff --git a/addons/sale/wizard/sale_make_invoice_advance.xml b/addons/sale/wizard/sale_make_invoice_advance.xml index 8d6b78e4f03..28f5dc093cd 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.xml +++ b/addons/sale/wizard/sale_make_invoice_advance.xml @@ -7,19 +7,35 @@ form
-
-
- - - + + - - + + +
+
diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index 3e3ffcb83f5..69bb610ae99 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -1,6 +1,17 @@ + + + + + Module Warehouse Management has been installed + Manage your product inventoy and stock locations. You can + control your stock moves history and planning, perform stock + valuation, and trace product lots upstream and downstream + (based on serial numbers.) + + Stock Journal Sequence