[MERGE] forward port of branch 7.0 up to 00ec786
This commit is contained in:
commit
a6024a6376
|
@ -356,13 +356,22 @@ class account_invoice(osv.osv):
|
|||
if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']:
|
||||
partner = self.pool[context['active_model']].read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
|
||||
if not view_type:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])
|
||||
try:
|
||||
view_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'invoice_tree')[1]
|
||||
except ValueError:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')], limit=1)
|
||||
view_type = 'tree'
|
||||
if view_type == 'form':
|
||||
if partner['supplier'] and not partner['customer']:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')])
|
||||
try:
|
||||
view_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'invoice_supplier_form')[1]
|
||||
except ValueError:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')], limit=1)
|
||||
elif partner['customer'] and not partner['supplier']:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')])
|
||||
try:
|
||||
view_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'invoice_form')[1]
|
||||
except ValueError:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')], limit=1)
|
||||
if view_id and isinstance(view_id, (list, tuple)):
|
||||
view_id = view_id[0]
|
||||
res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
|
|
|
@ -32,10 +32,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
self.account_ids = []
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'sum_litige': self._sum_litige,
|
||||
'get_fiscalyear': self._get_fiscalyear,
|
||||
'get_journal': self._get_journal,
|
||||
'get_filter': self._get_filter,
|
||||
|
@ -69,7 +65,20 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"WHERE a.type IN %s " \
|
||||
"AND a.active", (self.ACCOUNT_TYPE,))
|
||||
self.account_ids = [a for (a,) in self.cr.fetchall()]
|
||||
return super(partner_balance, self).set_context(objects, data, ids, report_type=report_type)
|
||||
res = super(partner_balance, self).set_context(objects, data, ids, report_type=report_type)
|
||||
lines = self.lines()
|
||||
sum_debit = sum_credit = sum_litige = 0
|
||||
for line in filter(lambda x: x['type'] == 3, lines):
|
||||
sum_debit += line['debit'] or 0
|
||||
sum_credit += line['credit'] or 0
|
||||
sum_litige += line['enlitige'] or 0
|
||||
self.localcontext.update({
|
||||
'lines': lambda: lines,
|
||||
'sum_debit': lambda: sum_debit,
|
||||
'sum_credit': lambda: sum_credit,
|
||||
'sum_litige': lambda: sum_litige,
|
||||
})
|
||||
return res
|
||||
|
||||
def lines(self):
|
||||
move_state = ['draft','posted']
|
||||
|
@ -235,62 +244,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
i = i + 1
|
||||
return completearray
|
||||
|
||||
def _sum_debit(self):
|
||||
move_state = ['draft','posted']
|
||||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"JOIN account_move am ON (am.id = l.move_id)" \
|
||||
"WHERE l.account_id IN %s" \
|
||||
"AND am.state IN %s" \
|
||||
"AND " + self.query + "",
|
||||
(tuple(self.account_ids), tuple(move_state)))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _sum_credit(self):
|
||||
move_state = ['draft','posted']
|
||||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"JOIN account_move am ON (am.id = l.move_id)" \
|
||||
"WHERE l.account_id IN %s" \
|
||||
"AND am.state IN %s" \
|
||||
"AND " + self.query + "",
|
||||
(tuple(self.account_ids), tuple(move_state)))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _sum_litige(self):
|
||||
#gives the total of move lines with blocked boolean set to TRUE for the report selection
|
||||
move_state = ['draft','posted']
|
||||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit-credit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"JOIN account_move am ON (am.id = l.move_id)" \
|
||||
"WHERE l.account_id IN %s" \
|
||||
"AND am.state IN %s" \
|
||||
"AND " + self.query + " " \
|
||||
"AND l.blocked=TRUE ",
|
||||
(tuple(self.account_ids), tuple(move_state), ))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _get_partners(self):
|
||||
|
||||
if self.result_selection == 'customer':
|
||||
|
|
|
@ -36,13 +36,15 @@ class account_analytic_profit(report_sxw.rml_parse):
|
|||
return user_obj.browse(self.cr, self.uid, ids)
|
||||
|
||||
def _journal_ids(self, form, user_id):
|
||||
if isinstance(user_id, (int, long)):
|
||||
user_id = [user_id]
|
||||
line_obj = self.pool['account.analytic.line']
|
||||
journal_obj = self.pool['account.analytic.journal']
|
||||
line_ids=line_obj.search(self.cr, self.uid, [
|
||||
('date', '>=', form['date_from']),
|
||||
('date', '<=', form['date_to']),
|
||||
('journal_id', 'in', form['journal_ids'][0][2]),
|
||||
('user_id', '=', user_id),
|
||||
('user_id', 'in', user_id),
|
||||
])
|
||||
ids=list(set([b.journal_id.id for b in line_obj.browse(self.cr, self.uid, line_ids)]))
|
||||
return journal_obj.browse(self.cr, self.uid, ids)
|
||||
|
|
|
@ -72,7 +72,7 @@ class sale_order_line(osv.osv):
|
|||
price=result['price_unit']
|
||||
else:
|
||||
return res
|
||||
|
||||
uom = result.get('product_uom', uom)
|
||||
product = product_obj.browse(cr, uid, product, context)
|
||||
list_price = pricelist_obj.price_get(cr, uid, [pricelist],
|
||||
product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order })
|
||||
|
|
|
@ -36,7 +36,11 @@ class sale_order_line(osv.osv):
|
|||
frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
|
||||
to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id
|
||||
if product:
|
||||
purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
|
||||
product = self.pool['product.product'].browse(cr, uid, product, context=context)
|
||||
purchase_price = product.standard_price
|
||||
to_uom = res.get('product_uom', uom)
|
||||
if to_uom != product.uom_id.id:
|
||||
purchase_price = self.pool['product.uom']._compute_price(cr, uid, product.uom_id.id, purchase_price, to_uom)
|
||||
ctx = context.copy()
|
||||
ctx['date'] = date_order
|
||||
price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False, context=ctx)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<field name="hide_tracking" invisible="1"/>
|
||||
<separator string="Transfer Products" name="product_separator"/>
|
||||
<field name="move_ids" context="{'hide_tracking': hide_tracking}">
|
||||
<tree editable="bottom" string="Product Moves">
|
||||
<tree editable="bottom" string="Product Moves" create="false">
|
||||
<field name="product_id" on_change="onchange_product_id(product_id)"/>
|
||||
<field name="quantity" />
|
||||
<field name="product_uom" groups="product.group_uom"/>
|
||||
|
|
Loading…
Reference in New Issue