diff options
| author | Saurang Suthar <ssu@tinyerp.com> | 2012-11-23 18:43:48 +0530 |
|---|---|---|
| committer | Saurang Suthar <ssu@tinyerp.com> | 2012-11-23 18:43:48 +0530 |
| commit | fbc3645720b2e1ca22db4277db7392a75ece9fb9 (patch) | |
| tree | b19bdaad0d03cb4e14a6a48a6f279c232bfe2002 | |
| parent | b5a04899791b048f00a7ac05a71912525e24a333 (diff) | |
| parent | eb9c03282cb17db7fb85d6905d39e1c3d2cc0203 (diff) | |
[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-fgi_sale_imp-ssu
bzr revid: ssu@tinyerp.com-20121123131348-l9pe8b7npnvpkfzc
| -rw-r--r-- | addons/sale/res_config.py | 2 | ||||
| -rw-r--r-- | addons/sale/sale_view.xml | 2 | ||||
| -rw-r--r-- | addons/sale/wizard/sale_line_invoice.py | 23 | ||||
| -rw-r--r-- | addons/sale/wizard/sale_line_invoice.xml | 12 | ||||
| -rw-r--r-- | addons/sale_stock/__openerp__.py | 1 |
5 files changed, 35 insertions, 5 deletions
diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index d8e9d0fef6f..de9615dea11 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -29,7 +29,7 @@ class sale_configuration(osv.osv_memory): _columns = { 'group_invoice_so_lines': fields.boolean('Generate invoices based on the sale order lines', 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'."), + help="To allow your salesman to make invoices for sale order lines using the menu 'Order Lines to Invoice'."), 'timesheet': fields.boolean('Prepare invoices based on timesheets', 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. diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 419047dbbd2..f5b98b36ed0 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -466,7 +466,7 @@ <form string="Sales Order Lines" version="7.0"> <header> <button name="button_cancel" string="Cancel" type="object" states="confirmed,exception" groups="base.group_user"/> - <button name="%(action_view_sale_order_line_make_invoice)d" string="Create Invoice" type="action" attrs="{'invisible': ['|',('invoiced', '=', 1), ('state', 'not in', ('confirmed', 'draft'))]}" class="oe_highlight" groups="base.group_user"/> + <button name="%(action_view_sale_order_line_make_invoice)d" string="Create Invoice" type="action" attrs="{'invisible': ['|',('invoiced', '=', 1), ('state', 'not in', ('confirmed', 'draft'))]}" class="oe_highlight oe_left" groups="base.group_user"/> <button name="button_done" string="Done" type="object" attrs="{'invisible': ['|',('invoiced', '=', 0), ('state', 'not in', ('confirmed', 'exception'))]}" class="oe_highlight" groups="base.group_user"/> <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/> </header> diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py index f442cbe0a8e..4caace0f9bf 100644 --- a/addons/sale/wizard/sale_line_invoice.py +++ b/addons/sale/wizard/sale_line_invoice.py @@ -109,9 +109,30 @@ class sale_order_line_make_invoice(osv.osv_memory): if not invoices: raise osv.except_osv(_('Warning!'), _('Invoice cannot be created for this Sales Order Line due to one of the following reasons:\n1.The state of this sales order line is either "draft" or "cancel"!\n2.The Sales Order Line is Invoiced!')) - + if context.get('open_invoices', False): + return self.open_invoices( cr, uid, ids, res, context=context) return {'type': 'ir.actions.act_window_close'} + 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': invoice_ids, + 'view_id': False, + 'views': [(form_id, 'form'), (tree_id, 'tree')], + 'context': {'type': 'out_invoice'}, + 'type': 'ir.actions.act_window', + } + sale_order_line_make_invoice() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale/wizard/sale_line_invoice.xml b/addons/sale/wizard/sale_line_invoice.xml index 2eb5d1ae47f..6144ff489f4 100644 --- a/addons/sale/wizard/sale_line_invoice.xml +++ b/addons/sale/wizard/sale_line_invoice.xml @@ -7,11 +7,19 @@ <field name="arch" type="xml"> <form string="Create invoices" version="7.0"> <header> + <separator string="Do you want to invoice the selected sale order lines?" /> + </header> + <p class="oe_grey"> + All items in these order lines will be invoiced. You can also invoice a percentage of the sale order + or a fixed price (for advances) directly from the sale order form if you prefer. + </p> + <footer> + <button name="make_invoices" string="Create & View Invoice" type="object" + context="{'open_invoices': True}" class="oe_highlight"/> <button name="make_invoices" string="Create Invoices" type="object" class="oe_highlight"/> or <button string="Cancel" class="oe_link" special="cancel" /> - </header> - <separator string="Do you really want to create the invoice(s)?" /> + </footer> </form> </field> </record> diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index 10773b44a3f..a849df295d4 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -52,6 +52,7 @@ You can choose flexible invoicing methods: 'company_view.xml', 'sale_stock_view.xml', 'sale_stock_workflow.xml', + 'stock_view.xml', 'res_config_view.xml', 'report/sale_report_view.xml', 'process/sale_stock_process.xml', |
