[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-fgi_sale_imp-ssu
bzr revid: ssu@tinyerp.com-20121123131348-l9pe8b7npnvpkfzc
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user