[MERGE] forward port of branch 7.0 up to f2f4391

This commit is contained in:
Denis Ledoux 2015-04-30 10:50:51 +02:00
commit 2c3c2b57db
6 changed files with 37 additions and 22 deletions

View File

@ -223,30 +223,37 @@ class account_account(osv.osv):
_description = "Account"
_parent_store = True
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context is None:
context = {}
def _where_calc(self, cr, uid, domain, active_test=True, context=None):
""" Convert domains to allow easier filtering:
code: force case insensitive and right side matching search
journal_id: restrict to the accounts sharing the same account.account.type
"""
pos = 0
while pos < len(args):
if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]:
args[pos] = ('code', '=like', tools.ustr(args[pos][2].replace('%', ''))+'%')
if args[pos][0] == 'journal_id':
if not args[pos][2]:
del args[pos]
while pos < len(domain):
if domain[pos][0] == 'code' and domain[pos][1] in ('like', 'ilike') and domain[pos][2]:
domain[pos] = ('code', '=like', tools.ustr(domain[pos][2].replace('%', '')) + '%')
if domain[pos][0] == 'journal_id':
if not domain[pos][2]:
del domain[pos]
continue
jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2], context=context)
if (not (jour.account_control_ids or jour.type_control_ids)) or not args[pos][2]:
args[pos] = ('type','not in',('consolidation','view'))
jour = self.pool.get('account.journal').browse(cr, uid, domain[pos][2], context=context)
if (not (jour.account_control_ids or jour.type_control_ids)) or not domain[pos][2]:
domain[pos] = ('type', 'not in', ('consolidation', 'view'))
continue
ids3 = map(lambda x: x.id, jour.type_control_ids)
ids1 = super(account_account, self).search(cr, uid, [('user_type', 'in', ids3)])
ids1 += map(lambda x: x.id, jour.account_control_ids)
args[pos] = ('id', 'in', ids1)
domain[pos] = ('id', 'in', ids1)
pos += 1
return super(account_account, self)._where_calc(cr, uid, domain, active_test, context)
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
""" Check presence of key 'consolidate_children' in context to include also the Consolidated Children
of found accounts into the result of the search
"""
if context and context.has_key('consolidate_children'): #add consolidated children of accounts
ids = super(account_account, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)

View File

@ -143,15 +143,18 @@ class tax_report(report_sxw.rml_parse, common_report_header):
account.name AS name, \
account.code AS code \
FROM account_move_line AS line, \
account_account AS account \
account_account AS account, \
account_move as move \
WHERE line.state <> %s \
AND line.move_id = move.id \
AND line.tax_code_id = %s \
AND line.account_id = account.id \
AND account.company_id = %s \
AND line.period_id IN %s\
AND account.active \
AND move.state <> %s \
GROUP BY account.id,account.name,account.code', ('draft', tax_code_id,
company_id, periods_ids,))
company_id, periods_ids, 'draft',))
res = self.cr.dictfetchall()
i = 0

View File

@ -315,7 +315,7 @@ class res_partner(osv.osv):
('reconcile_id', '=', False),
('state', '!=', 'draft'),
('company_id', '=', company_id),
('date_maturity', '<=', fields.date.context_today(self,cr,uid)),
'|', ('date_maturity', '=', False), ('date_maturity', '<=', fields.date.context_today(self, cr, uid)),
], context=context):
raise osv.except_osv(_('Error!'),_("The partner does not have any accounting entries to print in the overdue report for the current company."))
self.message_post(cr, uid, [ids[0]], body=_('Printed overdue payments report'), context=context)

View File

@ -55,7 +55,7 @@ class report_rappel(report_sxw.rml_parse):
('reconcile_id', '=', False),
('state', '!=', 'draft'),
('company_id', '=', company_id),
('date_maturity', '<=', fields.date.context_today(self,self.cr,self.uid)),
'|', ('date_maturity', '=', False), ('date_maturity', '<=', fields.date.context_today(self, self.cr, self.uid)),
])
# lines_per_currency = {currency: [line data, ...], ...}

View File

@ -69,6 +69,7 @@ class sale_order(osv.Model):
carrier_obj = self.pool.get('delivery.carrier')
acc_fp_obj = self.pool.get('account.fiscal.position')
self._delivery_unset(cr, uid, ids, context=context)
currency_obj = self.pool.get('res.currency')
for order in self.browse(cr, uid, ids, context=context):
grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id)
if not grid_id:
@ -82,6 +83,10 @@ class sale_order(osv.Model):
taxes = grid.carrier_id.product_id.taxes_id
fpos = order.fiscal_position or False
taxes_ids = acc_fp_obj.map_tax(cr, uid, fpos, taxes)
price_unit = grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context)
if order.company_id.currency_id.id != order.pricelist_id.currency_id.id:
price_unit = currency_obj.compute(cr, uid, order.company_id.currency_id.id, order.pricelist_id.currency_id.id,
price_unit, context=dict(context or {}, date=order.date_order))
#create the sale order line
line_obj.create(cr, uid, {
'order_id': order.id,
@ -89,7 +94,7 @@ class sale_order(osv.Model):
'product_uom_qty': 1,
'product_uom': grid.carrier_id.product_id.uom_id.id,
'product_id': grid.carrier_id.product_id.id,
'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context),
'price_unit': price_unit,
'tax_id': [(6, 0, taxes_ids)],
'type': 'make_to_stock',
'is_delivery': True

View File

@ -173,7 +173,7 @@ class note_note(osv.osv):
return result
else:
return super(note_note, self).read_group(self, cr, uid, domain, fields, groupby,
return super(note_note, self).read_group(cr, uid, domain, fields, groupby,
offset=offset, limit=limit, context=context, orderby=orderby)