[MERGE] forward port of saas-1 up to revision 8749 (mat@openerp.com-20130702135856-kmg7d8anw17nkbd8)

bzr revid: mat@openerp.com-20130702144646-y1wqs5mz4rzoh50g
This commit is contained in:
Martin Trigaux 2013-07-02 16:46:46 +02:00
commit d2d72d8416
37 changed files with 217 additions and 154 deletions

View File

@ -366,12 +366,13 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
return period or 0.0
def _get_partners(self,data):
# TODO: deprecated, to remove in trunk
if data['form']['result_selection'] == 'customer':
return 'Receivable Accounts'
return self._translate('Receivable Accounts')
elif data['form']['result_selection'] == 'supplier':
return 'Payable Accounts'
return self._translate('Payable Accounts')
elif data['form']['result_selection'] == 'customer_supplier':
return 'Receivable and Payable Accounts'
return self._translate('Receivable and Payable Accounts')
return ''
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',

View File

@ -147,7 +147,9 @@
<para style="terp_default_Centre_8">[[ data['form']['period_length'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ get_partners(data) ]]</para>
<para style="terp_default_Centre_8">Receivable Accounts[[ data['form']['result_selection'] == 'customer' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_8">Payable Accounts[[ data['form']['result_selection'] == 'supplier' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_8">Receivable and Payable Accounts[[ data['form']['result_selection'] == 'customer_supplier' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ data['form']['direction_selection'] ]]</para>
@ -166,7 +168,8 @@
<para style="terp_tblheader_Details">Partners</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]]</para>
<para style="terp_tblheader_Details_Right">Due[[ data['form']['direction_selection'] == 'future' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_Details_Right">Not due[[ data['form']['direction_selection'] != 'future' and ' ' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ data['form']['4']['name'] ]]</para>

View File

@ -211,8 +211,10 @@
</para>
<blockTable colWidths="130.0,80.0,100.0,140.0,90.0" style="Table8">
<tr>
<td><para style="terp_tblheader_General_Centre">[[ data['model']=='account.account' and 'Company'or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre"> [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td>
<para style="terp_tblheader_General_Centre">Company[[ data['model']=='account.account' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Fiscal Year</para>
</td>
@ -233,7 +235,11 @@
<td>
<para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para>
</td>
<td><para style="terp_default_Centre_8">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para></td>
<td>
<para style="terp_default_Centre_7">All[[ data['form']['display_account']=='all' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_7">With movements[[ data['form']['display_account']=='movement' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_7">With balance is not equal to 0[[ data['form']['display_account']=='not_zero' and ' ' or removeParentNode('para') ]]</para>
</td>
<td> <para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="60.0,60.0" style="Table5">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>

View File

@ -220,8 +220,8 @@
</blockTable>
<blockTable colWidths="80.0,100,80.0,150.0,100.0" style="Table2">
<tr>
<td><para style="terp_tblheader_General_Centre">[[ data['model']=='account.journal.period' and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre"> [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Company[[ data['model']=='account.journal.period' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journals</para></td>
<td><para style="terp_tblheader_General_Centre">Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]]</para></td>

View File

@ -360,9 +360,8 @@
<blockTable colWidths="110.0,110.0,110.0,110.0,128.0,93.0,110.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">[[ data['model']=='account.account' and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">[[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para>
</td>
<para style="terp_tblheader_General_Centre">Company[[ data['model']=='account.account' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]]</para></td>
<td>
<para style="terp_tblheader_General_Centre">Fiscal Year</para>
</td>
@ -395,7 +394,9 @@
<para style="terp_default_Centre_7">[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]</para>
</td>
<td>
<para style="terp_default_Centre_7">[[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]</para>
<para style="terp_default_Centre_7">All[[ data['form']['display_account']=='all' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_7">With movements[[ data['form']['display_account']=='movement' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_7">With balance is not equal to 0[[ data['form']['display_account']=='not_zero' and ' ' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Centre_7">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]]</para>

View File

@ -189,11 +189,12 @@ class journal_print(report_sxw.rml_parse, common_report_header):
return data['form']['amount_currency']
def _get_sortby(self, data):
# TODO: deprecated, to remove in trunk
if self.sort_selection == 'date':
return 'Date'
return self._translate('Date')
elif self.sort_selection == 'ref':
return 'Reference Number'
return 'Date'
return self._translate('Reference Number')
return self._translate('Date')
report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='external')
report_sxw.report_sxw('report.account.journal.period.print.sale.purchase', 'account.journal.period', 'addons/account/report/account_journal_sale_purchase.rml', parser=journal_print, header='external')

View File

@ -186,8 +186,8 @@
</para>
<blockTable colWidths="85.0,80.0,80.0,120.0,70.0,100.0" style="Table2">
<tr>
<td><para style="terp_tblheader_General_Centre"> [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">[[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Company[[ data['model']=='account.journal.period'and ' ' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journal</para></td>
<td><para style="terp_tblheader_General_Centre">Period</para></td>
@ -199,8 +199,10 @@
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.journal_id.name ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.period_id.name ]] </para></td>
<td><para style="terp_default_Centre_8">[[ get_sortby(data) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
<td>
<para style="terp_default_Centre_8">Date[[ data['form'].get('sort_selection', 'date') == 'date' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_8">Reference Number[[ data['form'].get('sort_selection', 'date') == 'ref' and ' ' or removeParentNode('para') ]]</para>
</td>
</tr>
</blockTable>
<para style="P9">

View File

@ -267,12 +267,13 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
return result_tmp + result_init
def _get_partners(self):
# TODO: deprecated, to remove in trunk
if self.result_selection == 'customer':
return 'Receivable Accounts'
return _('Receivable Accounts')
elif self.result_selection == 'supplier':
return 'Payable Accounts'
return _('Payable Accounts')
elif self.result_selection == 'customer_supplier':
return 'Receivable and Payable Accounts'
return _('Receivable and Payable Accounts')
return ''
def _sum_currency_amount_account(self, account, form):

View File

@ -423,7 +423,9 @@
</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ get_partners() ]]</para>
<para style="terp_default_Centre_8">Receivable Accounts[[ data['form'].get('result_selection', 'customer') == 'customer' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_8">Payable Accounts[[ data['form'].get('result_selection', 'customer') == 'supplier' or removeParentNode('para') ]]</para>
<para style="terp_default_Centre_8">Receivable and Payable Accounts[[ data['form'].get('result_selection', 'customer') == 'customer_supplier' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ get_target_move(data) ]]</para>

View File

@ -84,7 +84,7 @@ openerp.account.quickadd = function (instance) {
},
search_by_journal_period: function() {
var self = this;
var domain = [];
var domain = ['|',['debit', '!=', 0], ['credit', '!=', 0]];
if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]);
if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]);
self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal;

View File

@ -175,7 +175,7 @@ class account_common_report(osv.osv_memory):
data['form'][field] = data['form'][field][0]
used_context = self._build_contexts(cr, uid, ids, data, context=context)
data['form']['periods'] = used_context.get('periods', False) and used_context['periods'] or []
data['form']['used_context'] = used_context
data['form']['used_context'] = dict(used_context, lang=context.get('lang', 'en_US'))
return self._print_report(cr, uid, ids, data, context=context)

View File

@ -248,9 +248,12 @@
<field name="model">account.analytic.default</field>
<field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_tree"/>
<field name="arch" type="xml">
<field name="analytic_id" required="1" position="replace">
<xpath expr="//field[@name='analytic_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='analytic_id']" position="after">
<field name="analytics_id" required="1"/>
</field>
</xpath>
</field>
</record>

View File

@ -1510,7 +1510,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
continue
if r['class']=='private':
for f in r.keys():
if f not in ('id','date','date_deadline','duration','user_id','state'):
if f not in ('id','date','date_deadline','duration','user_id','state','interval','count'):
if isinstance(r[f], list):
r[f] = []
else:

View File

@ -96,13 +96,11 @@ class crm_lead(base_stage, format_address, osv.osv):
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
if not vals.get('stage_id'):
ctx = context.copy()
if vals.get('section_id'):
ctx['default_section_id'] = vals['section_id']
if vals.get('type'):
ctx['default_type'] = vals['type']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
if vals.get('type') and not context.get('default_type'):
context['default_type'] = vals.get('type')
if vals.get('section_id') and not context.get('default_section_id'):
context['default_section_id'] = vals.get('section_id')
# context: no_log, because subtype already handle this
create_context = dict(context, mail_create_nolog=True)
return super(crm_lead, self).create(cr, uid, vals, context=create_context)

View File

@ -58,7 +58,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_inbound_phone_tree_view"/>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="context">{'default_state': 'done'}</field>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">

View File

@ -56,7 +56,7 @@ class res_partner(osv.osv):
default.update({'opportunity_ids': [], 'meeting_ids' : [], 'phonecall_ids' : []})
super(res_partner, self).copy(cr, uid, record_id, default, context)
return super(res_partner, self).copy(cr, uid, record_id, default, context)
def redirect_partner_form(self, cr, uid, partner_id, context=None):
search_view = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'view_res_partner_filter')

View File

@ -66,7 +66,7 @@ class document_page(osv.osv):
'create_date': fields.datetime("Created on", select=True, readonly=True),
'create_uid': fields.many2one('res.users', 'Author', select=True, readonly=True),
'write_date': fields.datetime("Modification Date", select=True, readonly=True),
'write_uid': fields.many2one('res.users', "Last Contributor", select=True),
'write_uid': fields.many2one('res.users', "Last Contributor", select=True, readonly=True),
}
_defaults = {
'type':'content',

View File

@ -86,7 +86,7 @@
</group>
<notebook>
<page string="Description">
<field name="line_ids" context="{'currency_id': currency_id, 'default_analytic_account': context.get('analytic_account')}">
<field name="line_ids" context="{'currency_id': currency_id, 'default_analytic_account': context.get('analytic_account', '')}">
<form string="Expense Lines" version="7.0">
<group>
<group>

View File

@ -240,7 +240,7 @@ class hr_applicant(base_stage, osv.Model):
_defaults = {
'active': lambda *a: 1,
'user_id': lambda s, cr, uid, c: uid,
'user_id': lambda s, cr, uid, c: uid,
'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),
@ -253,13 +253,11 @@ class hr_applicant(base_stage, osv.Model):
}
def onchange_job(self, cr, uid, ids, job, context=None):
result = {}
if job:
job_obj = self.pool.get('hr.job')
result['department_id'] = job_obj.browse(cr, uid, job, context=context).department_id.id
return {'value': result}
return {'value': {'department_id': False}}
job_record = self.pool.get('hr.job').browse(cr, uid, job, context=context)
if job_record and job_record.department_id:
return {'value': {'department_id': job_record.department_id.id}}
return {}
def onchange_department_id(self, cr, uid, ids, department_id=False, context=None):
obj_recru_stage = self.pool.get('hr.recruitment.stage')
@ -403,6 +401,11 @@ class hr_applicant(base_stage, osv.Model):
return super(hr_applicant, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
if vals.get('department_id') and not context.get('default_department_id'):
context['default_department_id'] = vals.get('department_id')
obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
applicant = self.browse(cr, uid, obj_id, context=context)
if applicant.job_id:

View File

@ -187,6 +187,7 @@
<filter string="Next Actions" context="{'invisible_next_action':False, 'invisible_next_date':False}"
domain="[('date_action','&lt;&gt;',False)]" help="Filter and view on next actions and date"/>
<field name="job_id"/>
<field name="department_id"/>
<field name="user_id"/>
<separator/>
<field name="categ_ids"/>

View File

@ -173,7 +173,10 @@ class account_analytic_line(osv.osv):
data = {}
journal_types = {}
price = 0.0
for line in self.pool.get('account.analytic.line').browse(cr, uid, ids, context=context):
price += line.amount*-1
line_name = line.name
if line.journal_id.type not in journal_types:
journal_types[line.journal_id.type] = set()
journal_types[line.journal_id.type].add(line.account_id.id)
@ -204,7 +207,6 @@ class account_analytic_line(osv.osv):
'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id
}
context2 = context.copy()
context2['lang'] = partner.lang
# set company_id in context, so the correct default journal will be selected
@ -225,36 +227,42 @@ class account_analytic_line(osv.osv):
if data.get('product'):
product_id = data['product'][0]
product = product_obj.browse(cr, uid, product_id, context=context2)
if not product:
raise osv.except_osv(_('Error!'), _('There is no product defined. Please select one or force the product through the wizard.'))
factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2)
factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1]
if factor.customer_name:
factor_name += ' - ' + factor.customer_name
ctx = context.copy()
ctx.update({'uom':uom})
price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx)
general_account = product.property_account_income or product.categ_id.property_account_income_categ
if not general_account:
raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name)
taxes = product.taxes_id or general_account.tax_ids
tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes)
factor_name = factor.customer_name and line_name + ' - ' + factor.customer_name or line_name
curr_line = {
'price_unit': price,
'quantity': qty,
'discount':factor.factor,
'invoice_line_tax_id': [(6,0,tax )],
'discount': factor.factor,
'invoice_id': last_invoice,
'name': factor_name,
'product_id': product_id,
'invoice_line_tax_id': [(6,0,tax)],
'uos_id': uom,
'account_id': general_account.id,
'account_analytic_id': account.id,
}
if product:
factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1]
if factor.customer_name:
factor_name += ' - ' + factor.customer_name
ctx = context.copy()
ctx.update({'uom': uom})
# check force product
if data.get('product'):
price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx)
general_account = product.property_account_income or product.categ_id.property_account_income_categ
if not general_account:
raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name)
taxes = product.taxes_id or general_account.tax_ids
tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes)
curr_line.update({
'price_unit': price,
'invoice_line_tax_id': [(6,0,tax )],
'name': factor_name,
'product_id': product_id,
'invoice_line_tax_id': [(6,0,tax)],
'account_id': general_account.id,
})
#
# Compute for lines

View File

@ -93,7 +93,6 @@
help="Accepted Ideas" />
<group expand="0" string="Group By...">
<filter string="Creator" help="By Responsible" context="{'group_by': 'user_id'}"/>
<filter string="Category" help="By Category" context="{'group_by': 'category_ids'}"/>
<filter string="Status" help="By State" context="{'group_by': 'state'}"/>
</group>
</search>

View File

@ -117,6 +117,8 @@ class account_coda_import(osv.osv_memory):
# and so a 'like' operator would return the first account number in the database which matches.
cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (statement['acc_number'],))
bank_ids = [id[0] for id in cr.fetchall()]
# Filter bank accounts which are not allowed
bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('id', 'in', bank_ids)])
if bank_ids and len(bank_ids) > 0:
bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids)
for bank_acc in bank_accs:
@ -248,7 +250,7 @@ class account_coda_import(osv.osv_memory):
elif line[0] == '9':
statement['balanceMin'] = float(rmspaces(line[22:37])) / 1000
statement['balancePlus'] = float(rmspaces(line[37:52])) / 1000
if not statement['balance_end_real']:
if not statement.get('balance_end_real'):
statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin']
for i, statement in enumerate(statements):
statement['coda_note'] = ''
@ -266,6 +268,8 @@ class account_coda_import(osv.osv_memory):
raise osv.except_osv(_('Error'), _("Configuration Error in journal %s!\nPlease verify the Default Debit and Credit Account settings.") % statement['journal_id'].name)
if balance_start_check != statement['balance_start']:
statement['coda_note'] = _("The CODA Statement %s Starting Balance (%.2f) does not correspond with the previous Closing Balance (%.2f) in journal %s!") % (statement['description'] + ' #' + statement['paperSeqNumber'], statement['balance_start'], balance_start_check, statement['journal_id'].name)
if not(statement.get('period_id')):
raise osv.except_osv(_('Error') + ' R3006', _(' No transactions or no period in coda file !'))
data = {
'name': statement['paperSeqNumber'],
'date': statement['date'],

View File

@ -153,25 +153,33 @@ class account_invoice(osv.osv):
return {'value': {'reference': reference}}
def create(self, cr, uid, vals, context=None):
if vals.has_key('reference_type'):
reference_type = vals['reference_type']
reference = vals.get('reference', False)
reference_type = vals.get('reference_type', False)
if vals.get('type') == 'out_invoice' and not reference_type:
# fallback on default communication type for partner
reference_type = self.pool.get('res.partner').browse(cr, uid, vals['partner_id']).out_inv_comm_type
if reference_type == 'bba':
if vals.has_key('reference'):
bbacomm = vals['reference']
else:
reference = self.generate_bbacomm(cr, uid, [], vals['type'], reference_type, vals['partner_id'], '', context={})['value']['reference']
vals.update({
'reference_type': reference_type or 'none',
'reference': reference,
})
if reference_type == 'bba':
if not reference:
raise osv.except_osv(_('Warning!'),
_('Empty BBA Structured Communication!' \
'\nPlease fill in a unique BBA Structured Communication.'))
if self.check_bbacomm(reference):
reference = re.sub('\D', '', reference)
vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++'
same_ids = self.search(cr, uid,
[('type', '=', 'out_invoice'), ('reference_type', '=', 'bba'),
('reference', '=', vals['reference'])])
if same_ids:
raise osv.except_osv(_('Warning!'),
_('Empty BBA Structured Communication!' \
'\nPlease fill in a unique BBA Structured Communication.'))
if self.check_bbacomm(bbacomm):
reference = re.sub('\D', '', bbacomm)
vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++'
same_ids = self.search(cr, uid,
[('type', '=', 'out_invoice'), ('reference_type', '=', 'bba'),
('reference', '=', vals['reference'])])
if same_ids:
raise osv.except_osv(_('Warning!'),
_('The BBA Structured Communication has already been used!' \
'\nPlease create manually a unique BBA Structured Communication.'))
_('The BBA Structured Communication has already been used!' \
'\nPlease create manually a unique BBA Structured Communication.'))
return super(account_invoice, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):

View File

@ -101,8 +101,8 @@
<record id="gsttvq_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">GST + TVQ for sales</field>
<field name="description">GSTTVQ_SALE</field>
<field name="name">GST + QST for sales</field>
<field name="description">GSTQST_SALE</field>
<field name="type_tax_use">sale</field>
<field name="amount">1</field>
<field name="type">percent</field>
@ -127,8 +127,8 @@
<record id="tvq_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVQ for sales - 9.975%</field>
<field name="description">TVQ</field>
<field name="name">QST for sales - 9.975%</field>
<field name="description">QST</field>
<field name="type_tax_use">sale</field>
<field name="amount">0.099750</field>
<field name="type">percent</field>
@ -192,8 +192,8 @@
<record id="hst12_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for sales - 12%</field>
<field name="description">TVH12_SALE</field>
<field name="name">HST for sales - 12%</field>
<field name="description">HST12_SALE</field>
<field name="type_tax_use">sale</field>
<field name="amount">0.120000</field>
<field name="type">percent</field>
@ -207,8 +207,8 @@
<record id="hst13_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for sales - 13%</field>
<field name="description">TVH13_SALE</field>
<field name="name">HST for sales - 13%</field>
<field name="description">HST13_SALE</field>
<field name="type_tax_use">sale</field>
<field name="amount">0.130000</field>
<field name="type">percent</field>
@ -222,8 +222,8 @@
<record id="hst135_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for sales - 13.5%</field>
<field name="description">TVH135_SALE</field>
<field name="name">HST for sales - 13.5%</field>
<field name="description">HST135_SALE</field>
<field name="type_tax_use">sale</field>
<field name="amount">0.135000</field>
<field name="type">percent</field>
@ -237,8 +237,8 @@
<record id="hst15_sale_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for sales - 15%</field>
<field name="description">TVH15_SALE</field>
<field name="name">HST for sales - 15%</field>
<field name="description">HST15_SALE</field>
<field name="type_tax_use">sale</field>
<field name="amount">0.150000</field>
<field name="type">percent</field>
@ -367,8 +367,8 @@
<record id="gsttvq_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">GST + TVQ for purchases</field>
<field name="description">GSTTVQ_PURC</field>
<field name="name">GST + QST for purchases</field>
<field name="description">GSTQST_PURC</field>
<field name="type_tax_use">purchase</field>
<field name="amount">1</field>
<field name="type">percent</field>
@ -393,8 +393,8 @@
<record id="tvq_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVQ for purchases - 9.975%</field>
<field name="description">TVQ</field>
<field name="name">QST for purchases - 9.975%</field>
<field name="description">QST</field>
<field name="type_tax_use">purchase</field>
<field name="amount">0.099750</field>
<field name="type">percent</field>
@ -458,8 +458,8 @@
<record id="hst12_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for purchases - 12%</field>
<field name="description">TVH12_PURC</field>
<field name="name">HST for purchases - 12%</field>
<field name="description">HST12_PURC</field>
<field name="type_tax_use">purchase</field>
<field name="amount">0.120000</field>
<field name="type">percent</field>
@ -473,8 +473,8 @@
<record id="hst13_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for purchases - 13%</field>
<field name="description">TVH13_PURC</field>
<field name="name">HST for purchases - 13%</field>
<field name="description">HST13_PURC</field>
<field name="type_tax_use">purchase</field>
<field name="amount">0.130000</field>
<field name="type">percent</field>
@ -488,8 +488,8 @@
<record id="hst135_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for purchases - 13.5%</field>
<field name="description">TVH135_PURC</field>
<field name="name">HST for purchases - 13.5%</field>
<field name="description">HST135_PURC</field>
<field name="type_tax_use">purchase</field>
<field name="amount">0.135000</field>
<field name="type">percent</field>
@ -503,8 +503,8 @@
<record id="hst15_purc_en" model="account.tax.template">
<field name="chart_template_id" ref="ca_en_chart_template_en"/>
<field name="name">TVH for purchases - 15%</field>
<field name="description">TVH15_PURC</field>
<field name="name">HST for purchases - 15%</field>
<field name="description">HST15_PURC</field>
<field name="type_tax_use">purchase</field>
<field name="amount">0.150000</field>
<field name="type">percent</field>

View File

@ -24,8 +24,8 @@
{'name': 'Switzerland - Accounting',
'description': """
Swiss localization :
====================
Swiss localization
==================
**Multilang swiss STERCHI account chart and taxes**
**Author:** Camptocamp SA

View File

@ -176,7 +176,7 @@ class mail_mail(osv.Model):
if context is None:
context = {}
if not ids:
filters = ['&', ('state', '=', 'outgoing'), ('type', '=', 'email')]
filters = [('state', '=', 'outgoing')]
if 'filters' in context:
filters.extend(context['filters'])
ids = self.search(cr, uid, filters, context=context)

View File

@ -312,7 +312,12 @@ class mail_thread(osv.AbstractModel):
# subscribe uid unless asked not to
if not context.get('mail_create_nosubscribe'):
self.message_subscribe_users(cr, uid, [thread_id], [uid], context=context)
self.message_auto_subscribe(cr, uid, [thread_id], values.keys(), context=context)
# auto_subscribe: take values and defaults into account
create_values = set(values.keys())
for key, val in context.iteritems():
if key.startswith('default_'):
create_values.add(key[8:])
self.message_auto_subscribe(cr, uid, [thread_id], list(create_values), context=context)
# track values
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=context)
@ -1436,7 +1441,7 @@ class mail_thread(osv.AbstractModel):
], context=context)
mail_followers_obj.write(cr, SUPERUSER_ID, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context)
# subtype_ids not specified: do not update already subscribed partner, fetch default subtypes for new partners
else:
elif subtype_ids is None:
subtype_ids = subtype_obj.search(cr, uid, [
('default', '=', True),
'|',

View File

@ -975,11 +975,11 @@ class pos_order(osv.osv):
})
if data_type == 'product':
key = ('product', values['partner_id'], values['product_id'])
key = ('product', values['partner_id'], values['product_id'], values['debit'] > 0)
elif data_type == 'tax':
key = ('tax', values['partner_id'], values['tax_code_id'],)
key = ('tax', values['partner_id'], values['tax_code_id'], values['debit'] > 0)
elif data_type == 'counter_part':
key = ('counter_part', values['partner_id'], values['account_id'])
key = ('counter_part', values['partner_id'], values['account_id'], values['debit'] > 0)
else:
return

View File

@ -85,6 +85,7 @@ class pos_session_opening(osv.osv_memory):
session_ids = proxy.search(cr, uid, [
('state', '!=', 'closed'),
('config_id', '=', config_id),
('user_id', '=', uid),
], context=context)
if session_ids:
session = proxy.browse(cr, uid, session_ids[0], context=context)

View File

@ -12,7 +12,7 @@
<field eval="False" name="doall"/>
<field eval="'procurement.order'" name="model"/>
<field eval="'run_scheduler'" name="function"/>
<field eval="'(False,)'" name="args"/>
<field eval="'(False,True)'" name="args"/>
</record>
<record id="sequence_mrp_op_type" model="ir.sequence.type">

View File

@ -36,6 +36,8 @@ class procurement_order(osv.osv):
''' Runs through scheduler.
@param use_new_cursor: False or the dbname
'''
if use_new_cursor:
use_new_cursor = cr.dbname
self._procure_confirm(cr, uid, use_new_cursor=use_new_cursor, context=context)
self._procure_orderpoint_confirm(cr, uid, automatic=automatic,\
use_new_cursor=use_new_cursor, context=context)

View File

@ -586,6 +586,15 @@ class task(base_stage, osv.osv):
},
}
def _get_default_partner(self, cr, uid, context=None):
""" Override of base_stage to add project specific behavior """
project_id = self._get_default_project_id(cr, uid, context)
if project_id:
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
if project and project.partner_id:
return project.partner_id.id
return super(task, self)._get_default_partner(cr, uid, context=context)
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default section by checking if present in the context """
return (self._resolve_project_id_from_context(cr, uid, context=context) or False)
@ -600,7 +609,8 @@ class task(base_stage, osv.osv):
context key, or None if it cannot be resolved to a single
project.
"""
if context is None: context = {}
if context is None:
context = {}
if type(context.get('default_project_id')) in (int, long):
return context['default_project_id']
if isinstance(context.get('default_project_id'), basestring):
@ -681,13 +691,11 @@ class task(base_stage, osv.osv):
def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0):
return {'value':{'remaining_hours': planned - effective}}
def onchange_project(self, cr, uid, id, project_id):
if not project_id:
return {}
data = self.pool.get('project.project').browse(cr, uid, [project_id])
partner_id=data and data[0].partner_id
if partner_id:
return {'value':{'partner_id':partner_id.id}}
def onchange_project(self, cr, uid, id, project_id, context=None):
if project_id:
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
if project and project.partner_id:
return {'value': {'partner_id': project.partner_id.id}}
return {}
def duplicate_task(self, cr, uid, map_ids, context=None):
@ -810,8 +818,9 @@ class task(base_stage, osv.osv):
'progress': 0,
'sequence': 10,
'active': True,
'user_id': lambda obj, cr, uid, context: uid,
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c),
'user_id': lambda obj, cr, uid, ctx=None: uid,
'company_id': lambda self, cr, uid, ctx=None: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=ctx),
'partner_id': lambda self, cr, uid, ctx=None: self._get_default_partner(cr, uid, context=ctx),
}
_order = "priority, sequence, date_start, name, id"
@ -1111,11 +1120,9 @@ class task(base_stage, osv.osv):
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
if not vals.get('stage_id'):
ctx = context.copy()
if vals.get('project_id'):
ctx['default_project_id'] = vals['project_id']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
if vals.get('project_id') and not context.get('default_project_id'):
context['default_project_id'] = vals.get('project_id')
# context: no_log, because subtype already handle this
create_context = dict(context, mail_create_nolog=True)
task_id = super(task, self).create(cr, uid, vals, context=create_context)
@ -1127,11 +1134,6 @@ class task(base_stage, osv.osv):
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]
if vals.get('project_id'):
project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context)
if project_id:
vals.setdefault('message_follower_ids', [])
vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in project_id.message_follower_ids]
if vals and not 'kanban_state' in vals and 'stage_id' in vals:
new_stage = vals.get('stage_id')
vals_reset_kstate = dict(vals, kanban_state='normal')

View File

@ -65,15 +65,22 @@ class project_issue(base_stage, osv.osv):
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
if not vals.get('stage_id'):
ctx = context.copy()
if vals.get('project_id'):
ctx['default_project_id'] = vals['project_id']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
if vals.get('project_id') and not context.get('default_project_id'):
context['default_project_id'] = vals.get('project_id')
# context: no_log, because subtype already handle this
create_context = dict(context, mail_create_nolog=True)
return super(project_issue, self).create(cr, uid, vals, context=create_context)
def _get_default_partner(self, cr, uid, context=None):
""" Override of base_stage to add project specific behavior """
project_id = self._get_default_project_id(cr, uid, context)
if project_id:
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
if project and project.partner_id:
return project.partner_id.id
return super(project_issue, self)._get_default_partner(cr, uid, context=context)
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default project by checking if present in the context """
return self._resolve_project_id_from_context(cr, uid, context=context)
@ -215,6 +222,10 @@ class project_issue(base_stage, osv.osv):
return res
def on_change_project(self, cr, uid, ids, project_id, context=None):
if project_id:
project = self.pool.get('project.project').browse(cr, uid, project_id, context=context)
if project and project.partner_id:
return {'value': {'partner_id': project.partner_id.id}}
return {}
def _get_issue_task(self, cr, uid, ids, context=None):
@ -309,6 +320,7 @@ class project_issue(base_stage, osv.osv):
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': crm.AVAILABLE_PRIORITIES[2][0],
'kanban_state': 'normal',
'user_id': lambda obj, cr, uid, context: uid,
}
_group_by_full = {

View File

@ -26,9 +26,9 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<field name="state" position="after">
<xpath expr="//page[@string='Extra Info']//field[@name='state']" position="after">
<field name="sale_line_id" string="Order Line"/>
</field>
</xpath>
</field>
</record>
<record id="product_product_normal_form_supply_view" model="ir.ui.view">

View File

@ -173,7 +173,7 @@ class WebKitParser(report_sxw):
),
'w'
)
head_file.write(header)
head_file.write(header.encode('utf-8'))
head_file.close()
file_to_del.append(head_file.name)
command.extend(['--header-html', head_file.name])
@ -184,7 +184,7 @@ class WebKitParser(report_sxw):
),
'w'
)
foot_file.write(footer)
foot_file.write(footer.encode('utf-8'))
foot_file.close()
file_to_del.append(foot_file.name)
command.extend(['--footer-html', foot_file.name])
@ -205,7 +205,7 @@ class WebKitParser(report_sxw):
for html in html_list :
html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w')
count += 1
html_file.write(html)
html_file.write(html.encode('utf-8'))
html_file.close()
file_to_del.append(html_file.name)
command.append(html_file.name)

View File

@ -918,7 +918,7 @@
<field name="state" nolabel="1" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Customer"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Customer" domain="[('customer','=',True)]" />
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_out_id': partner_id, 'picking_type': 'out', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>
@ -1045,7 +1045,7 @@
<button name="action_process" states="assigned" string="Receive" type="object" class="oe_highlight"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Supplier"/>
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Supplier" domain="[('supplier','=',True)]" />
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>