Christophe Simonis 2013-07-18 13:59:28 +02:00
commit bf29a2ebc7
50 changed files with 354 additions and 259 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

@ -26,16 +26,15 @@ class purchase_order(osv.osv):
_inherit = "purchase.order"
_description = "Purchase Order"
def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
line = super(purchase_order, self)._prepare_inv_line(cr, uid, account_id, order_line, context=context)
def _choose_account_from_po_line(self, cr, uid, order_line, context=None):
account_id = super(purchase_order, self)._choose_account_from_po_line(cr, uid, order_line, context=context)
if order_line.product_id and not order_line.product_id.type == 'service':
acc_id = order_line.product_id.property_stock_account_input and order_line.product_id.property_stock_account_input.id
if not acc_id:
acc_id = order_line.product_id.categ_id.property_stock_account_input_categ and order_line.product_id.categ_id.property_stock_account_input_categ.id
if acc_id:
fpos = order_line.order_id.fiscal_position or False
new_account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, acc_id)
line.update({'account_id': new_account_id})
return line
account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, acc_id)
return account_id
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -932,6 +932,8 @@ class account_voucher(osv.osv):
move_pool = self.pool.get('account.move')
for voucher in self.browse(cr, uid, ids, context=context):
# refresh to make sure you don't unlink an already removed move
voucher.refresh()
recs = []
for line in voucher.move_ids:
if line.reconcile_id:

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

@ -1,7 +1,7 @@
#########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
# Copyright (C) 2004-2013 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -78,7 +78,7 @@ class ExportToRML( unohelper.Base, XJobExecutor ):
res = self.sock.execute(database, uid, self.password, 'ir.actions.report.xml', 'sxwtorml',base64.encodestring(data),file_type)
if res['report_rml_content']:
write_data_to_file( get_absolute_file_path( filename[7:] ), res['report_rml_content'] )
write_data_to_file(get_absolute_file_path(filename), res['report_rml_content'])
except Exception,e:
import traceback,sys
info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
@ -99,8 +99,12 @@ class ExportToRML( unohelper.Base, XJobExecutor ):
oFileDialog.setDefaultName(f_path )
sPath = oFileDialog.execute() == 1 and oFileDialog.Files[0] or None
sPath = oFileDialog.execute() == 1 and oFileDialog.Files[0] or ''
oFileDialog.dispose()
sPath = sPath[7:]
if sPath.startswith('localhost/'):
slash = int(os.name == 'nt')
sPath = sPath[9 + slash:]
return sPath
if __name__<>"package" and __name__=="__main__":

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)
@ -369,12 +367,11 @@ class crm_lead(base_stage, format_address, osv.osv):
def on_change_user(self, cr, uid, ids, user_id, context=None):
""" When changing the user, also set a section_id or restrict section id
to the ones user_id is member of. """
section_id = False
if user_id:
section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context)
if section_ids:
section_id = section_ids[0]
return {'value': {'section_id': section_id}}
return {'value': {'section_id': section_ids[0]}}
return {'value': {}}
def _check(self, cr, uid, ids=False, context=None):
""" Override of the base.stage method.

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

@ -155,7 +155,8 @@ class mail_compose_message(osv.TransientModel):
values['body'] = values.pop('body_html', '')
# transform email_to, email_cc into partner_ids
partner_ids = self._get_or_create_partners_from_values(cr, uid, values, context=context)
ctx = dict((k, v) for k, v in (context or {}).items() if not k.startswith('default_'))
partner_ids = self._get_or_create_partners_from_values(cr, uid, values, context=ctx)
# legacy template behavior: void values do not erase existing values and the
# related key is removed from the values dict
if partner_ids:

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')
@ -401,6 +399,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

@ -114,7 +114,6 @@
<field name="category_ids"/>
<group expand="0" string="Group By...">
<filter icon="terp-personal" string="Creator" help="By Creators" context="{'group_by':'create_uid'}"/>
<filter icon="terp-stock_symbol-selection" string="Category" help="By Idea Category" context="{'group_by':'category_ids'}"/>
<filter icon="terp-stock_effects-object-colorize" string="Status" help="By States" 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

@ -978,7 +978,7 @@
<field name="parent_id" ref="chart222020000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie naliczonego VAT-22%</field>
<field name="name">Rozliczenie naliczonego VAT-23%</field>
</record>
<record id="chart222020200" model="account.account.template">
@ -987,7 +987,16 @@
<field name="parent_id" ref="chart222020000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie naliczonego VAT-7%</field>
<field name="name">Rozliczenie naliczonego VAT-8%</field>
</record>
<record id="chart222020400" model="account.account.template">
<field name="code">222020400</field>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="chart222020000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie naliczonego VAT-5%</field>
</record>
<record id="chart222020300" model="account.account.template">
@ -1014,7 +1023,7 @@
<field name="parent_id" ref="chart222030000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie należnego VAT-22%</field>
<field name="name">Rozliczenie należnego VAT-23%</field>
</record>
<record id="chart222030200" model="account.account.template">
@ -1023,7 +1032,16 @@
<field name="parent_id" ref="chart222030000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie należnego VAT-7%</field>
<field name="name">Rozliczenie należnego VAT-8%</field>
</record>
<record id="chart222030400" model="account.account.template">
<field name="code">222030400</field>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="chart222030000"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_cash"/>
<field name="name">Rozliczenie należnego VAT-5%</field>
</record>
<record id="chart222030300" model="account.account.template">
@ -3176,15 +3194,15 @@
<!-- Chart template -->
<record id="pl_chart_template" model="account.chart.template">
<field name="name">Polska - Plan kont</field>
<field name="account_root_id" ref="chart0"/>
<field name="tax_code_root_id" ref="vat_code_tax"/>
<field name="bank_account_view_id" ref="chart113010000"/>
<field name="property_account_receivable" ref="chart220000000"/>
<field name="name">Polska - Plan kont</field>
<field name="account_root_id" ref="chart0"/>
<field name="tax_code_root_id" ref="vat_code_tax"/>
<field name="bank_account_view_id" ref="chart113010000"/>
<field name="property_account_receivable" ref="chart220000000"/>
<field name="property_account_payable" ref="chart221000000"/>
<field name="property_account_expense_categ" ref="chart330020000"/>
<field name="property_account_income_categ" ref="chart773010000"/>
</record>
</data>
</openerp>
</openerp>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="tax1" model="account.tax.template">
<record id="tax_vat_23_due" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT-22%(22.0%)</field>
<field name="amount">0.220000</field>
<field name="name">VAT-23%(23.0%)</field>
<field name="amount">0.230000</field>
<field name="type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_collected_id" ref="chart222030100"/>
@ -16,10 +16,10 @@
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax2" model="account.tax.template">
<record id="tax_vat_8_due" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT-7%(7.0%)</field>
<field name="amount">0.070000</field>
<field name="name">VAT-8%(8.0%)</field>
<field name="amount">0.080000</field>
<field name="type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_collected_id" ref="chart222030200"/>
@ -31,7 +31,22 @@
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax3" model="account.tax.template">
<record id="tax_vat_5_due" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT-5%(5.0%)</field>
<field name="amount">0.050000</field>
<field name="type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_collected_id" ref="chart222030400"/>
<field name="account_paid_id" ref="chart222030400"/>
<field name="base_code_id" ref="vat_code_base_due"/>
<field name="tax_code_id" ref="vat_code_due_tva"/>
<field name="ref_base_code_id" ref="vat_code_base_due"/>
<field name="ref_tax_code_id" ref="vat_code_due_tva"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax_vat_0_due" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT-0%(0.0%)</field>
<field name="amount">0.000000</field>
@ -46,10 +61,11 @@
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax4" model="account.tax.template">
<record id="tax_vat_23_recivable" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT naliczony-22%(22.0%)</field>
<field name="amount">0.220000</field>
<field name="name">VAT naliczony-23%(23.0%)</field>
<field name="amount">0.230000</field>
<field name="type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_collected_id" ref="chart222020100"/>
@ -61,10 +77,10 @@
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax5" model="account.tax.template">
<record id="tax_vat_8_recivable" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT naliczony-7%(7.0%)</field>
<field name="amount">0.070000</field>
<field name="name">VAT naliczony-8%(8.0%)</field>
<field name="amount">0.080000</field>
<field name="type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_collected_id" ref="chart222020200"/>
@ -76,7 +92,22 @@
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax6" model="account.tax.template">
<record id="tax_vat_5_recivable" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT naliczony-5%(5.0%)</field>
<field name="amount">0.050000</field>
<field name="type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_collected_id" ref="chart222020400"/>
<field name="account_paid_id" ref="chart222020200"/>
<field name="base_code_id" ref="vat_code_receivable_net"/>
<field name="tax_code_id" ref="vat_code_payable"/>
<field name="ref_base_code_id" ref="vat_code_receivable_net"/>
<field name="ref_tax_code_id" ref="vat_code_payable"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tax_vat_0_recivable" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT naliczony-0%(0.0%)</field>
<field name="amount">0.000000</field>
@ -92,4 +123,4 @@
<field name="ref_tax_sign" eval="-1"/>
</record>
</data>
</openerp>
</openerp>

View File

@ -7,7 +7,6 @@
<field name="model">res.partner</field>
<field name="arch" type="xml">
<xpath expr="//div[@name='vat_info']" position="after">
<label for="nrc"/>
<field name="nrc" placeholder="e.g. J12/1234/2012" class="oe_inline"/>
</xpath>
</field>

View File

@ -292,7 +292,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)
@ -1252,7 +1257,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

@ -969,11 +969,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

@ -290,7 +290,7 @@
<record id="peche" model="product.product">
<field name="available_in_pos">True</field>
<field name="list_price">5.10</field>
<field name="name">Fishing</field>
<field name="name">Peaches</field>
<field name="to_weight">True</field>
<field name="ean13">2300001000008</field>
<field name="pos_categ_id" ref="rouges_noyau_fruits"/>

View File

@ -12,6 +12,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
this.weight = 0;
this.weighting = false;
this.debug_weight = 0;
this.use_debug_weight = false;
this.paying = false;
this.default_payment_status = {
@ -92,38 +94,36 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
// and a weighting_end()
weighting_read_kg: function(){
var self = this;
if(this.bypass_proxy){
return this.weight;
}else{
this.message('weighting_read_kg',{})
.done(function(weight){
if(self.weighting && !self.bypass_proxy){
this.message('weighting_read_kg',{})
.done(function(weight){
if(self.weighting){
if(self.use_debug_weight){
self.weight = self.debug_weight;
}else{
self.weight = weight;
}
});
return this.weight;
}
}
});
return this.weight;
},
// sets a custom weight, ignoring the proxy returned value.
debug_set_weight: function(kg){
this.bypass_proxy = true;
this.weight = kg;
this.use_debug_weight = true;
this.debug_weight = kg;
},
// resets the custom weight and re-enable listening to the proxy for weight values
debug_reset_weight: function(){
this.bypass_proxy = false;
this.weight = 0;
this.use_debug_weight = false;
this.debug_weight = 0;
},
// the client has finished weighting products
weighting_end: function(){
if(!this.bypass_proxy){
this.weight = 0;
this.weighting = false;
this.message('weighting_end');
}
this.weight = 0;
this.weighting = false;
this.message('weighting_end');
},
// the pos asks the client to pay 'price' units

View File

@ -104,7 +104,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return self.fetch('res.currency',['symbol','position','rounding','accuracy'],[['id','=',self.get('company').currency_id[0]]]);
}).then(function(currencies){
console.log('Currency:',currencies[0]);
self.set('currency',currencies[0]);
return self.fetch('product.uom', null, null);
@ -234,8 +233,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
on_removed_order: function(removed_order){
if( this.get('orders').isEmpty()){
this.add_new_order();
}
if( this.get('selectedOrder') === removed_order){
}else{
this.set({ selectedOrder: this.get('orders').last() });
}
},

View File

@ -459,7 +459,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){
clearInterval(this.intervalID);
self.pos.proxy.weighting_end();
self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
}
});
@ -820,7 +819,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
click: function() { self.finishOrder(); },
});
window.print();
this.print();
},
print: function() {
window.print();

View File

@ -743,6 +743,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}
});
this.$('.button.reset_weight').click(function(){
self.$('input.weight').val('');
self.pos.proxy.debug_reset_weight();
});
this.$('.button.custom_ean').click(function(){

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

@ -593,6 +593,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)
@ -607,7 +616,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):
@ -688,13 +698,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):
@ -769,7 +777,8 @@ class task(base_stage, osv.osv):
" * Blocked indicates something is preventing the progress of this task\n"
" * Ready for next stage indicates the task is ready to be pulled to the next stage",
readonly=True, required=False),
'create_date': fields.datetime('Create Date', readonly=True,select=True),
'create_date': fields.datetime('Create Date', readonly=True, select=True),
'write_date': fields.datetime('Last Modification Date', readonly=True, select=True), #not displayed in the view but it might be useful with base_action_rule module (and it needs to be defined first for that)
'date_start': fields.datetime('Starting Date',select=True),
'date_end': fields.datetime('Ending Date',select=True),
'date_deadline': fields.date('Deadline',select=True),
@ -817,8 +826,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"
@ -1118,11 +1128,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)
@ -1134,11 +1142,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

@ -467,6 +467,20 @@ class purchase_order(osv.osv):
self.write(cr, uid, [id], {'state' : 'confirmed', 'validator' : uid})
return True
def _choose_account_from_po_line(self, cr, uid, po_line, context=None):
fiscal_obj = self.pool.get('account.fiscal.position')
property_obj = self.pool.get('ir.property')
if po_line.product_id:
acc_id = po_line.product_id.property_account_expense.id
if not acc_id:
acc_id = po_line.product_id.categ_id.property_account_expense_categ.id
if not acc_id:
raise osv.except_osv(_('Error!'), _('Define expense account for this company: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,))
else:
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category').id
fpos = po_line.order_id.fiscal_position or False
return fiscal_obj.map_account(cr, uid, fpos, acc_id)
def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
"""Collects require data from purchase order line that is used to create invoice line
for that purchase order line
@ -507,8 +521,6 @@ class purchase_order(osv.osv):
journal_obj = self.pool.get('account.journal')
inv_obj = self.pool.get('account.invoice')
inv_line_obj = self.pool.get('account.invoice.line')
fiscal_obj = self.pool.get('account.fiscal.position')
property_obj = self.pool.get('ir.property')
for order in self.browse(cr, uid, ids, context=context):
pay_acc_id = order.partner_id.property_account_payable.id
@ -520,17 +532,7 @@ class purchase_order(osv.osv):
# generate invoice line correspond to PO line and link that to created invoice (inv_id) and PO line
inv_lines = []
for po_line in order.order_line:
if po_line.product_id:
acc_id = po_line.product_id.property_account_expense.id
if not acc_id:
acc_id = po_line.product_id.categ_id.property_account_expense_categ.id
if not acc_id:
raise osv.except_osv(_('Error!'), _('Define expense account for this company: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,))
else:
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category').id
fpos = order.fiscal_position or False
acc_id = fiscal_obj.map_account(cr, uid, fpos, acc_id)
acc_id = self._choose_account_from_po_line(cr, uid, po_line, context=context)
inv_line_data = self._prepare_inv_line(cr, uid, acc_id, po_line, context=context)
inv_line_id = inv_line_obj.create(cr, uid, inv_line_data, context=context)
inv_lines.append(inv_line_id)

View File

@ -48,12 +48,11 @@ class purchase_line_invoice(osv.osv_memory):
if record_ids:
res = False
invoices = {}
invoice_obj=self.pool.get('account.invoice')
purchase_line_obj=self.pool.get('purchase.order.line')
property_obj=self.pool.get('ir.property')
account_fiscal_obj=self.pool.get('account.fiscal.position')
invoice_line_obj=self.pool.get('account.invoice.line')
account_jrnl_obj=self.pool.get('account.journal')
invoice_obj = self.pool.get('account.invoice')
purchase_obj = self.pool.get('purchase.order')
purchase_line_obj = self.pool.get('purchase.order.line')
invoice_line_obj = self.pool.get('account.invoice.line')
account_jrnl_obj = self.pool.get('account.journal')
def multiple_order_invoice_notes(orders):
notes = ""
@ -93,35 +92,14 @@ class purchase_line_invoice(osv.osv_memory):
order.write({'invoice_ids': [(4, inv_id)]})
return inv_id
for line in purchase_line_obj.browse(cr,uid,record_ids):
if (not line.invoiced) and (line.state not in ('draft','cancel')):
for line in purchase_line_obj.browse(cr, uid, record_ids, context=context):
if (not line.invoiced) and (line.state not in ('draft', 'cancel')):
if not line.partner_id.id in invoices:
invoices[line.partner_id.id] = []
if line.product_id:
a = line.product_id.property_account_expense.id
if not a:
a = line.product_id.categ_id.property_account_expense_categ.id
if not a:
raise osv.except_osv(_('Error!'),
_('Define expense account for this product: "%s" (id:%d).') % \
(line.product_id.name, line.product_id.id,))
else:
a = property_obj.get(cr, uid,
'property_account_expense_categ', 'product.category',
context=context).id
fpos = line.order_id.fiscal_position or False
a = account_fiscal_obj.map_account(cr, uid, fpos, a)
inv_id = invoice_line_obj.create(cr, uid, {
'name': line.name,
'origin': line.order_id.name,
'account_id': a,
'price_unit': line.price_unit,
'quantity': line.product_qty,
'uos_id': line.product_uom.id,
'product_id': line.product_id.id or False,
'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])],
'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False,
})
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, line, context=context)
inv_line_data = purchase_obj._prepare_inv_line(cr, uid, acc_id, line, context=context)
inv_line_data.update({'origin': line.order_id.name})
inv_id = invoice_line_obj.create(cr, uid, inv_line_data, context=context)
purchase_line_obj.write(cr, uid, [line.id], {'invoiced': True, 'invoice_lines': [(4, inv_id)]})
invoices[line.partner_id.id].append((line,inv_id))

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'}"/>