[MERGE] merged the xrg branch, containing several small fixes
bzr revid: qdp-launchpad@tinyerp.com-20101203120543-fp3k1adikqs45bjc
This commit is contained in:
@@ -300,19 +300,15 @@ class account_move_line(osv.osv):
|
||||
context = {}
|
||||
c = context.copy()
|
||||
c['initital_bal'] = True
|
||||
sql = [
|
||||
"""SELECT l2.id, SUM(l1.debit-l1.credit) FROM account_move_line l1, account_move_line l2""",
|
||||
"""WHERE l2.account_id = l1.account_id""",
|
||||
"""AND""",
|
||||
"""l1.id <= l2.id""",
|
||||
"""AND""",
|
||||
"""l2.id IN %s""",
|
||||
"""AND""",
|
||||
self._query_get(cr, uid, obj='l1', context=c),
|
||||
""" GROUP BY l2.id""",
|
||||
]
|
||||
sql = """SELECT l2.id, SUM(l1.debit-l1.credit)
|
||||
FROM account_move_line l1, account_move_line l2
|
||||
WHERE l2.account_id = l1.account_id
|
||||
AND l1.id <= l2.id
|
||||
AND l2.id IN %%s AND """ + \
|
||||
self._query_get(cr, uid, obj='l1', context=c) + \
|
||||
" GROUP BY l2.id"
|
||||
|
||||
cr.execute('\n'.join(sql), [tuple(ids)])
|
||||
cr.execute(sql, [tuple(ids)])
|
||||
res = dict(cr.fetchall())
|
||||
return res
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ class account_invoice(osv.osv):
|
||||
raise orm.except_orm(_('Configuration Error!'),
|
||||
_('There is no Accounting Journal of type Sale/Purchase defined!'))
|
||||
else:
|
||||
raise orm.except_orm(_('UnknownError'), str(e))
|
||||
raise orm.except_orm(_('Unknown Error'), str(e))
|
||||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'paid'}, context=context)
|
||||
|
||||
@@ -42,13 +42,9 @@
|
||||
Print the Aged Partner Balance Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import warnings
|
||||
import md5
|
||||
import hashlib
|
||||
warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*")
|
||||
start = datetime.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
|
||||
start = datetime(int(start.year), int(start.month), int(start.day))
|
||||
res = {}
|
||||
@@ -71,12 +67,18 @@
|
||||
|
||||
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
||||
|
||||
data_dict = {'model': 'ir.ui.menu', 'form': {'chart_account_id':ref('account.chart0'),'initial_balance': 1, 'periods': period_list,'journal_ids':journal_ids, 'page_split': 0, 'date_from': time.strftime('%Y-%m-%d'), 'period_length': 30, 'amount_currency': 0,'query_line' : query_line, 'result_selection': 'customer','direction_selection': 'past','fiscalyear_id':fy_id}}
|
||||
data_dict = {'model': 'ir.ui.menu', 'form': \
|
||||
{'chart_account_id':ref('account.chart0'),
|
||||
'initial_balance': 1, 'periods': period_list,
|
||||
'journal_ids':journal_ids, 'page_split': 0,
|
||||
'date_from': time.strftime('%Y-%m-%d'),
|
||||
'period_length': 30, 'amount_currency': 0,
|
||||
'query_line' : query_line, 'result_selection':
|
||||
'customer','direction_selection':
|
||||
'past','fiscalyear_id':fy_id } }
|
||||
data_dict['form'].update(res)
|
||||
(data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-aged_partner_balance.'+format), 'wb+').write(data)
|
||||
|
||||
from tools.test_reports import try_report
|
||||
try_report(cr, uid, 'report.account.aged_trial_balance', [], data_dict, context={})
|
||||
-
|
||||
Print the Account Balance Sheet in Horizontal mode
|
||||
-
|
||||
|
||||
@@ -153,7 +153,7 @@ class account_analytic_account(osv.osv):
|
||||
}
|
||||
|
||||
def check_recursion(self, cr, uid, ids, parent=None):
|
||||
return super(account_analytic_account, self).check_recursion(cr, uid, ids, parent=parent)
|
||||
return super(account_analytic_account, self)._check_recursion(cr, uid, ids, parent=parent)
|
||||
|
||||
_order = 'date_start desc,parent_id desc,code'
|
||||
_constraints = [
|
||||
|
||||
@@ -185,7 +185,7 @@ class board_note_type(osv.osv):
|
||||
Board note Type
|
||||
"""
|
||||
_name = 'board.note.type'
|
||||
_description = "NOte Type"
|
||||
_description = "Note Type"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Note Type', size=64, required=True),
|
||||
|
||||
@@ -19,20 +19,11 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_calendar_event_export" model="ir.actions.act_window">
|
||||
<field name="name">Export .ics File</field>
|
||||
<field name="res_model">calendar.event.export</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_calendar_event_export"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window id="action_calendar_event_export_values"
|
||||
key2="client_action_multi" name="Export .ics File"
|
||||
res_model="calendar.event.export" src_model="basic.calendar"
|
||||
view_id="view_calendar_event_export"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
|
||||
@@ -37,18 +37,10 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_calendar_event_import" model="ir.actions.act_window">
|
||||
<field name="name">Import .ics File</field>
|
||||
<field name="res_model">calendar.event.import</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_calendar_event_import"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_calendar_event_import_values"
|
||||
key2="client_action_multi" name="Import .ics File"
|
||||
res_model="calendar.event.import" src_model="basic.calendar"
|
||||
view_id="view_calendar_event_import"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import claim_delivery
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class stock_picking(osv.osv):
|
||||
_inherit = "stock.picking"
|
||||
_columns = {
|
||||
'partner_id': fields.related('address_id', 'partner_id', type='many2one', relation="res.partner", string="Partner"),
|
||||
}
|
||||
|
||||
stock_picking()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -266,7 +266,7 @@ class crm_segmentation(osv.osv):
|
||||
}
|
||||
|
||||
_constraints = [
|
||||
(orm.orm.check_recursion, 'Error ! You can not create recursive profiles.', ['parent_id'])
|
||||
(orm.orm._check_recursion, 'Error ! You can not create recursive profiles.', ['parent_id'])
|
||||
]
|
||||
|
||||
def process_continue(self, cr, uid, ids, start=False):
|
||||
|
||||
@@ -160,13 +160,12 @@ class stock_move(osv.osv):
|
||||
_columns = {
|
||||
'weight': fields.function(_cal_move_weight, method=True, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
|
||||
store={
|
||||
'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_id', 'product_qty', 'product_uom'], 20),
|
||||
'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_qty', 'product_uom'], 20),
|
||||
}),
|
||||
'weight_net': fields.function(_cal_move_weight, method=True, type='float', string='Net weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
|
||||
store={
|
||||
'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_id', 'product_qty', 'product_uom'], 20),
|
||||
'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_qty', 'product_uom'], 20),
|
||||
}),
|
||||
|
||||
}
|
||||
|
||||
stock_move()
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
import base64
|
||||
import random
|
||||
import netsvc
|
||||
import logging
|
||||
import re
|
||||
|
||||
LOGGER = netsvc.Logger()
|
||||
|
||||
TEMPLATE_ENGINES = []
|
||||
|
||||
from osv import osv, fields
|
||||
@@ -35,12 +34,9 @@ from tools.translate import _
|
||||
try:
|
||||
from mako.template import Template as MakoTemplate
|
||||
TEMPLATE_ENGINES.append(('mako', 'Mako Templates'))
|
||||
except:
|
||||
LOGGER.notifyChannel(
|
||||
_("Email Template"),
|
||||
netsvc.LOG_WARNING,
|
||||
_("Mako templates not installed")
|
||||
)
|
||||
except ImportError:
|
||||
logging.getLogger('init').warning("module email_template: Mako templates not installed")
|
||||
|
||||
try:
|
||||
from django.template import Context, Template as DjangoTemplate
|
||||
#Workaround for bug:
|
||||
@@ -49,12 +45,8 @@ try:
|
||||
settings.configure()
|
||||
#Workaround ends
|
||||
TEMPLATE_ENGINES.append(('django', 'Django Template'))
|
||||
except:
|
||||
LOGGER.notifyChannel(
|
||||
_("Email Template"),
|
||||
netsvc.LOG_WARNING,
|
||||
_("Django templates not installed")
|
||||
)
|
||||
except ImportError:
|
||||
logging.getLogger('init').warning("module email_template: Django templates not installed")
|
||||
|
||||
import tools
|
||||
import pooler
|
||||
|
||||
+1
-11
@@ -247,17 +247,7 @@ class event_event(osv.osv):
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
"""
|
||||
Checks for recursion level for event
|
||||
"""
|
||||
level = 100
|
||||
while len(ids):
|
||||
cr.execute('SELECT DISTINCT parent_id FROM event_event WHERE id IN %s', (tuple(ids),))
|
||||
ids = filter(None, map(lambda x: x[0], cr.fetchall()))
|
||||
if not level:
|
||||
return False
|
||||
level -= 1
|
||||
return True
|
||||
return super(event_event, self)._check_recursion(cr, uid, ids)
|
||||
|
||||
def _check_closing_date(self, cr, uid, ids):
|
||||
for event in self.browse(cr, uid, ids):
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
!python {model: account.analytic.line}: |
|
||||
account_id = self.pool.get('account.analytic.line')
|
||||
accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0]
|
||||
account_id = self.pool.get('account.analytic.line')
|
||||
accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0]
|
||||
exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0]
|
||||
analytic_account_obj = self.pool.get('account.analytic.account')
|
||||
data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0]
|
||||
|
||||
@@ -16,18 +16,12 @@
|
||||
In order to test the PDF reports defined on a l10n_ch, we will print BVR Report
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import netsvc, tools, os
|
||||
run_str = 'cp ' + tools.config['addons_path'] + '/l10n_ch/report/ocrbb.ttf' + ' ' + '/tmp/ocrbb.ttf'
|
||||
os.system(run_str)
|
||||
(data, format) = netsvc.LocalService('report.l10n_ch.bvr').create(cr, uid, [ref('test_invoice_1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'l10ch-bvr_report.'+format), 'wb+').write(data)
|
||||
from tools.test_reports import try_report
|
||||
try_report(cr, uid, 'report.l10n_ch.bvr', [ref('test_invoice_1')])
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a l10n_ch, we will print a BVR Invoice Report
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.l10n_ch.invoice.bvr').create(cr, uid, [ref('test_invoice_1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'l10ch-bvr_invoice_report.'+format), 'wb+').write(data)
|
||||
from tools.test_reports import try_report
|
||||
try_report(cr, uid, 'report.l10n_ch.invoice.bvr', [ref('test_invoice_1')])
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_id" ref="product_product_jambon" />
|
||||
<field name="ean">12345678901234</field>
|
||||
<field name="ean"></field>
|
||||
<field name="weight">10</field>
|
||||
<field name="weight_ul">240</field>
|
||||
</record>
|
||||
@@ -63,7 +63,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_id" ref="product_product_from" />
|
||||
<field name="ean">12345678901234</field>
|
||||
<field name="ean"></field>
|
||||
<field name="weight">10</field>
|
||||
<field name="weight_ul">240</field>
|
||||
</record>
|
||||
@@ -92,7 +92,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_id" ref="product_product_pain" />
|
||||
<field name="ean">12345678901234</field>
|
||||
<field name="ean"></field>
|
||||
<field name="weight">10</field>
|
||||
<field name="weight_ul">240</field>
|
||||
</record>
|
||||
@@ -121,7 +121,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_id" ref="product_product_lait" />
|
||||
<field name="ean">12345678901234</field>
|
||||
<field name="ean"></field>
|
||||
<field name="weight">10</field>
|
||||
<field name="weight_ul">240</field>
|
||||
</record>
|
||||
|
||||
@@ -15,7 +15,14 @@
|
||||
res_model="project.project" view_mode="tree,form"
|
||||
view_type="form"/>
|
||||
|
||||
<act_window domain="[('user_id','=',uid),('state','<>','close')]" id="act_my_account" name="My accounts to invoice" res_model="account.analytic.account" view_mode="tree,form" view_type="form"/>
|
||||
<act_window
|
||||
id="act_my_account"
|
||||
name="My accounts to invoice"
|
||||
res_model="account.analytic.account"
|
||||
domain="[('user_id','=',uid),('state','<>','close')]"
|
||||
view_id="account.view_account_analytic_account_tree"
|
||||
view_mode="tree,form"
|
||||
view_type="form"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -55,7 +55,7 @@ class stock_picking(osv.osv):
|
||||
ondelete='set null', select=True),
|
||||
}
|
||||
_defaults = {
|
||||
'purchase_id': lambda *a: False,
|
||||
'purchase_id': False,
|
||||
}
|
||||
|
||||
def get_currency_id(self, cursor, user, picking):
|
||||
|
||||
@@ -188,7 +188,7 @@ class stock_picking(osv.osv):
|
||||
})
|
||||
return result
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context={}):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
res = super(stock_picking, self).action_cancel(cr, uid, ids, context=context)
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
call_ship_end = True
|
||||
|
||||
@@ -94,13 +94,13 @@ class account_invoice_line(osv.osv):
|
||||
_columns = {
|
||||
'cost_price': fields.float('Cost Price', digits=(16, 2)),
|
||||
}
|
||||
def write(self, cr, uid, ids, vals, context={}):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if vals.get('product_id', False):
|
||||
res = self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
|
||||
vals['cost_price'] = res[0]['standard_price']
|
||||
return super(account_invoice_line, self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if vals.get('product_id',False):
|
||||
res = self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
|
||||
vals['cost_price'] = res[0]['standard_price']
|
||||
|
||||
@@ -52,10 +52,10 @@ class stock_location_path(osv.osv):
|
||||
),
|
||||
}
|
||||
_defaults = {
|
||||
'auto': lambda *arg: 'auto',
|
||||
'delay': lambda *arg: 1,
|
||||
'invoice_state': lambda *args: 'none',
|
||||
'picking_type':lambda *args:'internal',
|
||||
'auto': 'auto',
|
||||
'delay': 1,
|
||||
'invoice_state': 'none',
|
||||
'picking_type': 'internal',
|
||||
}
|
||||
stock_location_path()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user