[MERGE] forward port of branch 7.0 up to 69bfc5e
This commit is contained in:
commit
32246d963d
|
@ -26,6 +26,30 @@ from openerp import workflow
|
||||||
class sale_order_line_make_invoice(osv.osv_memory):
|
class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
_name = "sale.order.line.make.invoice"
|
_name = "sale.order.line.make.invoice"
|
||||||
_description = "Sale OrderLine Make_invoice"
|
_description = "Sale OrderLine Make_invoice"
|
||||||
|
|
||||||
|
def _prepare_invoice(self, cr, uid, order, lines, context=None):
|
||||||
|
a = order.partner_id.property_account_receivable.id
|
||||||
|
if order.partner_id and order.partner_id.property_payment_term.id:
|
||||||
|
pay_term = order.partner_id.property_payment_term.id
|
||||||
|
else:
|
||||||
|
pay_term = False
|
||||||
|
return {
|
||||||
|
'name': order.client_order_ref or '',
|
||||||
|
'origin': order.name,
|
||||||
|
'type': 'out_invoice',
|
||||||
|
'reference': "P%dSO%d" % (order.partner_id.id, order.id),
|
||||||
|
'account_id': a,
|
||||||
|
'partner_id': order.partner_invoice_id.id,
|
||||||
|
'invoice_line': [(6, 0, lines)],
|
||||||
|
'currency_id' : order.pricelist_id.currency_id.id,
|
||||||
|
'comment': order.note,
|
||||||
|
'payment_term': pay_term,
|
||||||
|
'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
|
||||||
|
'user_id': order.user_id and order.user_id.id or False,
|
||||||
|
'company_id': order.company_id and order.company_id.id or False,
|
||||||
|
'date_invoice': fields.date.today(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def make_invoices(self, cr, uid, ids, context=None):
|
def make_invoices(self, cr, uid, ids, context=None):
|
||||||
"""
|
"""
|
||||||
|
@ -55,27 +79,7 @@ class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
@return:
|
@return:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
a = order.partner_id.property_account_receivable.id
|
inv = self._prepare_invoice(cr, uid, order, lines)
|
||||||
if order.partner_id and order.partner_id.property_payment_term.id:
|
|
||||||
pay_term = order.partner_id.property_payment_term.id
|
|
||||||
else:
|
|
||||||
pay_term = False
|
|
||||||
inv = {
|
|
||||||
'name': order.client_order_ref or '',
|
|
||||||
'origin': order.name,
|
|
||||||
'type': 'out_invoice',
|
|
||||||
'reference': "P%dSO%d" % (order.partner_id.id, order.id),
|
|
||||||
'account_id': a,
|
|
||||||
'partner_id': order.partner_invoice_id.id,
|
|
||||||
'invoice_line': [(6, 0, lines)],
|
|
||||||
'currency_id' : order.pricelist_id.currency_id.id,
|
|
||||||
'comment': order.note,
|
|
||||||
'payment_term': pay_term,
|
|
||||||
'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
|
|
||||||
'user_id': order.user_id and order.user_id.id or False,
|
|
||||||
'company_id': order.company_id and order.company_id.id or False,
|
|
||||||
'date_invoice': fields.date.today(),
|
|
||||||
}
|
|
||||||
inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
|
inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
|
||||||
return inv_id
|
return inv_id
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,28 @@ class sale_order(osv.osv):
|
||||||
return invoice_vals
|
return invoice_vals
|
||||||
|
|
||||||
|
|
||||||
|
class sale_advance_payment_inv(osv.osv_memory):
|
||||||
|
_inherit = 'sale.advance.payment.inv'
|
||||||
|
|
||||||
|
def _prepare_advance_invoice_vals(self, cr, uid, ids, context=None):
|
||||||
|
result = super(sale_advance_payment_inv, self)._prepare_advance_invoice_vals(cr, uid, ids, context=context)
|
||||||
|
orders = dict((order.id, order) for order in self.pool['sale.order'].browse(cr, uid, [order_id for order_id, values in result], context=context))
|
||||||
|
for order_id, values in result:
|
||||||
|
if orders.get(order_id) and orders[order_id].section_id:
|
||||||
|
values['section_id'] = orders[order_id].section_id.id
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
|
_inherit = "sale.order.line.make.invoice"
|
||||||
|
|
||||||
|
def _prepare_invoice(self, cr, uid, order, lines, context=None):
|
||||||
|
result = super(sale_order_line_make_invoice, self)._prepare_invoice(cr, uid, order, lines, context=context)
|
||||||
|
if order.section_id:
|
||||||
|
result['section_id'] = order.section_id.id
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class crm_case_section(osv.osv):
|
class crm_case_section(osv.osv):
|
||||||
_inherit = 'crm.case.section'
|
_inherit = 'crm.case.section'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue