[MERGE] forward port of branch 7.0 up to revid 9236 mat@openerp.com-20130613160953-itt79mu5xrl7suv4

bzr revid: chs@openerp.com-20130613181503-82234mo34wxb0oap
This commit is contained in:
Christophe Simonis 2013-06-13 20:15:03 +02:00
commit 6a9adbca62
93 changed files with 1489 additions and 1388 deletions

View File

@ -648,10 +648,10 @@ class account_account(osv.osv):
if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
#Check for 'Closed' type #Check for 'Closed' type
if old_type == 'closed' and new_type !='closed': if old_type == 'closed' and new_type !='closed':
raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type as it contains journal items!")) raise osv.except_osv(_('Warning!'), _("You cannot change the type of account from 'Closed' to any other type as it contains journal items!"))
# Forbid to change an account type for restricted_groups as it contains journal items (or if one of its children does) # Forbid to change an account type for restricted_groups as it contains journal items (or if one of its children does)
if (new_type in restricted_groups): if (new_type in restricted_groups):
raise osv.except_osv(_('Warning !'), _("You cannot change the type of account to '%s' type as it contains journal items!") % (new_type,)) raise osv.except_osv(_('Warning!'), _("You cannot change the type of account to '%s' type as it contains journal items!") % (new_type,))
return True return True
@ -1015,14 +1015,14 @@ class account_period(osv.osv):
if not result: if not result:
result = self.search(cr, uid, args, context=context) result = self.search(cr, uid, args, context=context)
if not result: if not result:
raise osv.except_osv(_('Error !'), _('There is no period defined for this date: %s.\nPlease create one.')%dt) raise osv.except_osv(_('Error!'), _('There is no period defined for this date: %s.\nPlease create one.')%dt)
return result return result
def action_draft(self, cr, uid, ids, *args): def action_draft(self, cr, uid, ids, *args):
mode = 'draft' mode = 'draft'
for period in self.browse(cr, uid, ids): for period in self.browse(cr, uid, ids):
if period.fiscalyear_id.state == 'done': if period.fiscalyear_id.state == 'done':
raise osv.except_osv(_('Warning !'), _('You can not re-open a period which belongs to closed fiscal year')) raise osv.except_osv(_('Warning!'), _('You can not re-open a period which belongs to closed fiscal year'))
cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),)) cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),))
cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),)) cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),))
return True return True
@ -2317,7 +2317,7 @@ class account_model(osv.osv):
try: try:
entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')} entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')}
except: except:
raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !')) raise osv.except_osv(_('Wrong Model!'), _('You have a wrong expression "%(...)s" in your model!'))
move_id = account_move_obj.create(cr, uid, { move_id = account_move_obj.create(cr, uid, {
'ref': entry['name'], 'ref': entry['name'],
'period_id': period_id, 'period_id': period_id,
@ -2329,7 +2329,7 @@ class account_model(osv.osv):
analytic_account_id = False analytic_account_id = False
if line.analytic_account_id: if line.analytic_account_id:
if not model.journal_id.analytic_journal_id: if not model.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (model.journal_id.name,)) raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (model.journal_id.name,))
analytic_account_id = line.analytic_account_id.id analytic_account_id = line.analytic_account_id.id
val = { val = {
'move_id': move_id, 'move_id': move_id,

View File

@ -65,12 +65,11 @@ class bank(osv.osv):
# Find the code and parent of the bank account to create # Find the code and parent of the bank account to create
dig = 6 dig = 6
current_num = 1 current_num = 1
ids = obj_acc.search(cr, uid, [('type','=','liquidity'), ('company_id', '=', bank.company_id.id)], context=context) ids = obj_acc.search(cr, uid, [('type','=','liquidity'), ('company_id', '=', bank.company_id.id), ('parent_id', '!=', False)], context=context)
# No liquidity account exists, no template available # No liquidity account exists, no template available
if not ids: continue if not ids: continue
ref_acc_bank_temp = obj_acc.browse(cr, uid, ids[0], context=context) ref_acc_bank = obj_acc.browse(cr, uid, ids[0], context=context).parent_id
ref_acc_bank = ref_acc_bank_temp.parent_id
while True: while True:
new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num) new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num)
ids = obj_acc.search(cr, uid, [('code', '=', new_code), ('company_id', '=', bank.company_id.id)]) ids = obj_acc.search(cr, uid, [('code', '=', new_code), ('company_id', '=', bank.company_id.id)])
@ -82,7 +81,7 @@ class bank(osv.osv):
'name': name, 'name': name,
'code': new_code, 'code': new_code,
'type': 'liquidity', 'type': 'liquidity',
'user_type': ref_acc_bank_temp.user_type.id, 'user_type': ref_acc_bank.user_type.id,
'reconcile': False, 'reconcile': False,
'parent_id': ref_acc_bank.id, 'parent_id': ref_acc_bank.id,
'company_id': bank.company_id.id, 'company_id': bank.company_id.id,

View File

@ -420,7 +420,7 @@ class account_bank_statement(osv.osv):
for st_line in st.line_ids: for st_line in st.line_ids:
if st_line.analytic_account_id: if st_line.analytic_account_id:
if not st.journal_id.analytic_journal_id: if not st.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,)) raise osv.except_osv(_('No Analytic Journal!'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,))
if not st_line.amount: if not st_line.amount:
continue continue
st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context) st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)

View File

@ -252,7 +252,7 @@ class account_cash_statement(osv.osv):
for statement in statement_pool.browse(cr, uid, ids, context=context): for statement in statement_pool.browse(cr, uid, ids, context=context):
vals = {} vals = {}
if not self._user_allow(cr, uid, statement.id, context=context): if not self._user_allow(cr, uid, statement.id, context=context):
raise osv.except_osv(_('Error!'), (_('You do not have rights to open this %s journal !') % (statement.journal_id.name, ))) raise osv.except_osv(_('Error!'), (_('You do not have rights to open this %s journal!') % (statement.journal_id.name, )))
if statement.name and statement.name == '/': if statement.name and statement.name == '/':
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id} c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}

View File

@ -51,9 +51,12 @@ class account_invoice(osv.osv):
company_id = context.get('company_id', user.company_id.id) company_id = context.get('company_id', user.company_id.id)
type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'} type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
journal_obj = self.pool.get('account.journal') journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')), domain = [('company_id', '=', company_id)]
('company_id', '=', company_id)], if isinstance(type_inv, list):
limit=1) domain.append(('type', 'in', [type2journal.get(type) for type in type_inv if type2journal.get(type)]))
else:
domain.append(('type', '=', type2journal.get(type_inv, 'sale')))
res = journal_obj.search(cr, uid, domain, limit=1)
return res and res[0] or False return res and res[0] or False
def _get_currency(self, cr, uid, context=None): def _get_currency(self, cr, uid, context=None):
@ -69,7 +72,7 @@ class account_invoice(osv.osv):
tt = type2journal.get(type_inv, 'sale') tt = type2journal.get(type_inv, 'sale')
result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context) result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context)
if not result: if not result:
raise osv.except_osv(_('No Analytic Journal !'),_("You must define an analytic journal of type '%s'!") % (tt,)) raise osv.except_osv(_('No Analytic Journal!'),_("You must define an analytic journal of type '%s'!") % (tt,))
return result[0] return result[0]
def _get_type(self, cr, uid, context=None): def _get_type(self, cr, uid, context=None):
@ -578,6 +581,10 @@ class account_invoice(osv.osv):
return {'value': {}} return {'value': {}}
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id, context=None): def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id, context=None):
#TODO: add the missing context parameter when forward-porting in trunk so we can remove
# this hack!
context = self.pool['res.users'].context_get(cr, uid)
val = {} val = {}
dom = {} dom = {}
obj_journal = self.pool.get('account.journal') obj_journal = self.pool.get('account.journal')
@ -630,18 +637,17 @@ class account_invoice(osv.osv):
obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id']) obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id'])
if obj_l.company_id.id != company_id: if obj_l.company_id.id != company_id:
raise osv.except_osv(_('Configuration Error!'), raise osv.except_osv(_('Configuration Error!'),
_('Invoice line account\'s company and invoice\'s compnay does not match.')) _('Invoice line account\'s company and invoice\'s company does not match.'))
else: else:
continue continue
if company_id and type: if company_id and type:
if type in ('out_invoice'): journal_mapping = {
journal_type = 'sale' 'out_invoice': 'sale',
elif type in ('out_refund'): 'out_refund': 'sale_refund',
journal_type = 'sale_refund' 'in_refund': 'purchase_refund',
elif type in ('in_refund'): 'in_invoice': 'purchase',
journal_type = 'purchase_refund' }
else: journal_type = journal_mapping[type]
journal_type = 'purchase'
journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)])
if journal_ids: if journal_ids:
val['journal_id'] = journal_ids[0] val['journal_id'] = journal_ids[0]
@ -651,7 +657,12 @@ class account_invoice(osv.osv):
if r[1] == 'journal_id' and r[2] in journal_ids: if r[1] == 'journal_id' and r[2] in journal_ids:
val['journal_id'] = r[2] val['journal_id'] = r[2]
if not val.get('journal_id', False): if not val.get('journal_id', False):
raise osv.except_osv(_('Configuration Error!'), (_('Cannot find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Journals\Journals.') % (journal_type))) journal_type_map = dict(obj_journal._columns['type'].selection)
journal_type_label = self.pool['ir.translation']._get_source(cr, uid, None, ('code','selection'),
context.get('lang'),
journal_type_map.get(journal_type))
raise osv.except_osv(_('Configuration Error!'),
_('Cannot find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Journals\Journals.') % ('"%s"' % journal_type_label))
dom = {'journal_id': [('id', 'in', journal_ids)]} dom = {'journal_id': [('id', 'in', journal_ids)]}
else: else:
journal_ids = obj_journal.search(cr, uid, []) journal_ids = obj_journal.search(cr, uid, [])
@ -766,7 +777,7 @@ class account_invoice(osv.osv):
else: else:
ref = self._convert_ref(cr, uid, inv.number) ref = self._convert_ref(cr, uid, inv.number)
if not inv.journal_id.analytic_journal_id: if not inv.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,)) raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,))
il['analytic_lines'] = [(0,0, { il['analytic_lines'] = [(0,0, {
'name': il['name'], 'name': il['name'],
'date': inv['date_invoice'], 'date': inv['date_invoice'],
@ -892,7 +903,7 @@ class account_invoice(osv.osv):
if not inv.journal_id.sequence_id: if not inv.journal_id.sequence_id:
raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.')) raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.'))
if not inv.invoice_line: if not inv.invoice_line:
raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.')) raise osv.except_osv(_('No Invoice Lines!'), _('Please create some invoice lines.'))
if inv.move_id: if inv.move_id:
continue continue
@ -913,7 +924,7 @@ class account_invoice(osv.osv):
group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context) group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context)
if group_check_total and uid in [x.id for x in group_check_total.users]: if group_check_total and uid in [x.id for x in group_check_total.users]:
if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)): if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)):
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.')) raise osv.except_osv(_('Bad Total!'), _('Please verify the price of the invoice!\nThe encoded total does not match the computed total.'))
if inv.payment_term: if inv.payment_term:
total_fixed = total_percent = 0 total_fixed = total_percent = 0
@ -948,7 +959,7 @@ class account_invoice(osv.osv):
total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml, context=ctx) total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml, context=ctx)
acc_id = inv.account_id.id acc_id = inv.account_id.id
name = inv['name'] or '/' name = inv['name'] or inv['supplier_invoice_number'] or '/'
totlines = False totlines = False
if inv.payment_term: if inv.payment_term:
totlines = payment_term_obj.compute(cr, totlines = payment_term_obj.compute(cr,
@ -1147,12 +1158,12 @@ class account_invoice(osv.osv):
if not ids: if not ids:
return [] return []
types = { types = {
'out_invoice': 'Invoice ', 'out_invoice': _('Invoice'),
'in_invoice': 'Sup. Invoice ', 'in_invoice': _('Supplier Invoice'),
'out_refund': 'Refund ', 'out_refund': _('Refund'),
'in_refund': 'Supplier Refund ', 'in_refund': _('Supplier Refund'),
} }
return [(r['id'], (r['number']) or types[r['type']] + (r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')] return [(r['id'], '%s %s' % (r['number'] or types[r['type']], r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args: if not args:
@ -1455,7 +1466,7 @@ class account_invoice_line(osv.osv):
context = dict(context) context = dict(context)
context.update({'company_id': company_id, 'force_company': company_id}) context.update({'company_id': company_id, 'force_company': company_id})
if not partner_id: if not partner_id:
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") ) raise osv.except_osv(_('No Partner Defined!'),_("You must first select a partner!") )
if not product: if not product:
if type in ('in_invoice', 'in_refund'): if type in ('in_invoice', 'in_refund'):
return {'value': {}, 'domain':{'product_uom':[]}} return {'value': {}, 'domain':{'product_uom':[]}}

View File

@ -192,7 +192,7 @@ class account_move_line(osv.osv):
for obj_line in self.browse(cr, uid, ids, context=context): for obj_line in self.browse(cr, uid, ids, context=context):
if obj_line.analytic_account_id: if obj_line.analytic_account_id:
if not obj_line.journal_id.analytic_journal_id: if not obj_line.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, )) raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, ))
vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context) vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context)
acc_ana_line_obj.create(cr, uid, vals_line) acc_ana_line_obj.create(cr, uid, vals_line)
return True return True
@ -1066,12 +1066,12 @@ class account_move_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
ctx = context.copy() ctx = context.copy()
if ('journal_id' not in ctx): if not ctx.get('journal_id'):
if line.move_id: if line.move_id:
ctx['journal_id'] = line.move_id.journal_id.id ctx['journal_id'] = line.move_id.journal_id.id
else: else:
ctx['journal_id'] = line.journal_id.id ctx['journal_id'] = line.journal_id.id
if ('period_id' not in ctx): if not ctx.get('period_id'):
if line.move_id: if line.move_id:
ctx['period_id'] = line.move_id.period_id.id ctx['period_id'] = line.move_id.period_id.id
else: else:
@ -1101,7 +1101,7 @@ class account_move_line(osv.osv):
period = period_obj.browse(cr, uid, period_id, context=context) period = period_obj.browse(cr, uid, period_id, context=context)
for (state,) in result: for (state,) in result:
if state == 'done': if state == 'done':
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name)))
if not result: if not result:
jour_period_obj.create(cr, uid, { jour_period_obj.create(cr, uid, {
'name': (journal.code or journal.name)+':'+(period.name or ''), 'name': (journal.code or journal.name)+':'+(period.name or ''),
@ -1181,7 +1181,7 @@ class account_move_line(osv.osv):
move_id = move_obj.create(cr, uid, v, context) move_id = move_obj.create(cr, uid, v, context)
vals['move_id'] = move_id vals['move_id'] = move_id
else: else:
raise osv.except_osv(_('No piece number !'), _('Cannot create an automatic sequence for this piece.\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')) raise osv.except_osv(_('No Piece Number!'), _('Cannot create an automatic sequence for this piece.\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
ok = not (journal.type_control_ids or journal.account_control_ids) ok = not (journal.type_control_ids or journal.account_control_ids)
if ('account_id' in vals): if ('account_id' in vals):
account = account_obj.browse(cr, uid, vals['account_id'], context=context) account = account_obj.browse(cr, uid, vals['account_id'], context=context)

View File

@ -585,7 +585,10 @@
<field name="date"/> <field name="date"/>
<field name="name"/> <field name="name"/>
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="['|',('parent_id','=',False),('is_company','=',True)]"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[
'&amp;',
'|',('parent_id','=',False),('is_company','=',True),
'|',('customer','=',True),('supplier','=',True)]"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/> <field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/> <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>

View File

@ -111,7 +111,7 @@ class account_installer(osv.osv_memory):
def check_unconfigured_cmp(self, cr, uid, context=None): def check_unconfigured_cmp(self, cr, uid, context=None):
""" check if there are still unconfigured companies """ """ check if there are still unconfigured companies """
if not self.get_unconfigured_cmp(cr, uid, context=context): if not self.get_unconfigured_cmp(cr, uid, context=context):
raise osv.except_osv(_('No unconfigured company !'), _("There is currently no company without chart of account. The wizard will therefore not be executed.")) raise osv.except_osv(_('No unconfigured company!'), _("There is currently no company without chart of account. The wizard will therefore not be executed."))
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None: context = {} if context is None: context = {}

View File

@ -363,7 +363,7 @@
<field name="inherit_id" ref="account.view_account_journal_form"/> <field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="type" position="after"> <field name="type" position="after">
<field name="analytic_journal_id"/> <field name="analytic_journal_id" groups="analytic.group_analytic_accounting"/>
</field> </field>
</field> </field>
</record> </record>

View File

@ -239,7 +239,7 @@
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td> <td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,15) ]]</para></td> <td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,15) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,25) ]]</para></td> <td><para style="terp_default_8">[[ strip_name(line.name,25) ]]</para></td>
<td><para style="P8">[[ line.tax_code_id and (line.tax_code_id.code + ':') ]]</para></td> <td><para style="P8">[[ line.tax_code_id and line.tax_code_id.code and (line.tax_code_id.code + ':') ]]</para></td>
<td><para style="terp_default_8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td> <td><para style="terp_default_8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td> <td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td> <td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
@ -292,7 +292,7 @@
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td> <td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,12) ]]</para></td> <td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,12) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,16) ]]</para></td> <td><para style="terp_default_8">[[ strip_name(line.name,16) ]]</para></td>
<td><para style="terp_default_8">[[ line.tax_code_id and (line.tax_code_id.code + ':') ]]</para></td> <td><para style="terp_default_8">[[ line.tax_code_id and line.tax_code_id.code and (line.tax_code_id.code + ':') ]]</para></td>
<td><para style="P8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td> <td><para style="P8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td> <td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td> <td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>

View File

@ -38,7 +38,7 @@ class account_fiscalyear_close(osv.osv_memory):
'report_name': fields.char('Name of new entries',size=64, required=True, help="Give name of the new entries"), 'report_name': fields.char('Name of new entries',size=64, required=True, help="Give name of the new entries"),
} }
_defaults = { _defaults = {
'report_name': _('End of Fiscal Year Entry'), 'report_name': lambda self, cr, uid, context: _('End of Fiscal Year Entry'),
} }
def data_save(self, cr, uid, ids, context=None): def data_save(self, cr, uid, ids, context=None):

View File

@ -57,7 +57,7 @@ class validate_account_move_lines(osv.osv_memory):
move_ids.append(line.move_id.id) move_ids.append(line.move_id.id)
move_ids = list(set(move_ids)) move_ids = list(set(move_ids))
if not move_ids: if not move_ids:
raise osv.except_osv(_('Warning!'), _('Selected Entry Lines does not have any account move enties in draft state.')) raise osv.except_osv(_('Warning!'), _('Selected Entry Lines does not have any account move entries in draft state.'))
obj_move.button_validate(cr, uid, move_ids, context) obj_move.button_validate(cr, uid, move_ids, context)
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}

View File

@ -72,8 +72,8 @@ class account_invoice_line(osv.osv):
_inherit = "account.invoice.line" _inherit = "account.invoice.line"
_description = "Invoice Line" _description = "Invoice Line"
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
res_prod = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, currency_id=currency_id, context=context, company_id=company_id) res_prod = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty, name, type, partner_id, fposition_id, price_unit, currency_id=currency_id, context=context, company_id=company_id)
rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context=context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context=context)
if rec: if rec:
res_prod['value'].update({'account_analytic_id': rec.analytic_id.id}) res_prod['value'].update({'account_analytic_id': rec.analytic_id.id})

View File

@ -332,7 +332,7 @@ class account_move_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
if line.analytics_id: if line.analytics_id:
if not line.journal_id.analytic_journal_id: if not line.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal.") % (line.journal_id.name,)) raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal.") % (line.journal_id.name,))
toremove = analytic_line_obj.search(cr, uid, [('move_id','=',line.id)], context=context) toremove = analytic_line_obj.search(cr, uid, [('move_id','=',line.id)], context=context)
if toremove: if toremove:
@ -471,7 +471,7 @@ class account_bank_statement(osv.osv):
for st_line in st.line_ids: for st_line in st.line_ids:
if st_line.analytics_id: if st_line.analytics_id:
if not st.journal_id.analytic_journal_id: if not st.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal.") % (st.journal_id.name,)) raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal.") % (st.journal_id.name,))
if not st_line.amount: if not st_line.amount:
continue continue
return True return True

View File

@ -10,7 +10,7 @@
<field name="inherit_id" ref="account.view_account_journal_form"/> <field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="centralisation" position="before"> <field name="centralisation" position="before">
<field name="plan_id" /> <field name="plan_id" groups="analytic.group_analytic_accounting"/>
</field> </field>
</field> </field>
</record> </record>

View File

@ -136,9 +136,9 @@ class account_invoice_line(osv.osv):
res += diff_res res += diff_res
return res return res
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
fiscal_pool = self.pool.get('account.fiscal.position') fiscal_pool = self.pool.get('account.fiscal.position')
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, currency_id, context, company_id) res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty, name, type, partner_id, fposition_id, price_unit, currency_id, context, company_id)
if not product: if not product:
return res return res
if type in ('in_invoice','in_refund'): if type in ('in_invoice','in_refund'):

View File

@ -13,6 +13,17 @@
</field> </field>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="view_invoice_asset_category">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line']/tree/field[@name='quantity']" position="before">
<field name="asset_category_id"/>
</xpath>
</field>
</record>
</data> </data>
</openerp> </openerp>

View File

@ -203,7 +203,9 @@
<field name="view_id" ref="crossovered_budget_view_tree"/> <field name="view_id" ref="crossovered_budget_view_tree"/>
<field name="search_view_id" ref="view_crossovered_budget_search"/> <field name="search_view_id" ref="view_crossovered_budget_search"/>
<field name="help" type="html"> <field name="help" type="html">
<p> <p class="oe_view_nocontent_create">
Click to create a new budget.
</p><p>
A budget is a forecast of your company's income and/or expenses A budget is a forecast of your company's income and/or expenses
expected for a period in the future. A budget is defined on some expected for a period in the future. A budget is defined on some
financial accounts and/or analytic accounts (that may represent financial accounts and/or analytic accounts (that may represent

View File

@ -3,5 +3,5 @@ access_account_followup_followup_line,account_followup.followup.line,model_accou
access_account_followup_followup_line_manager,account_followup.followup.line.manager,model_account_followup_followup_line,account.group_account_manager,1,1,1,1 access_account_followup_followup_line_manager,account_followup.followup.line.manager,model_account_followup_followup_line,account.group_account_manager,1,1,1,1
access_account_followup_followup_accountant,account_followup.followup user,model_account_followup_followup,account.group_account_invoice,1,0,0,0 access_account_followup_followup_accountant,account_followup.followup user,model_account_followup_followup,account.group_account_invoice,1,0,0,0
access_account_followup_followup_manager,account_followup.followup.manager,model_account_followup_followup,account.group_account_manager,1,1,1,1 access_account_followup_followup_manager,account_followup.followup.manager,model_account_followup_followup,account.group_account_manager,1,1,1,1
access_account_followup_stat_invoice,account_followup.stat.invoice,model_account_followup_stat,account.group_account_invoice,1,1,1,1 access_account_followup_stat_invoice,account_followup.stat.invoice,model_account_followup_stat,account.group_account_invoice,1,1,0,0
access_account_followup_stat_by_partner_manager,account_followup.stat.by.partner,model_account_followup_stat_by_partner,account.group_account_user,1,1,1,1 access_account_followup_stat_by_partner_manager,account_followup.stat.by.partner,model_account_followup_stat_by_partner,account.group_account_user,1,1,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_account_followup_followup_line_manager account_followup.followup.line.manager model_account_followup_followup_line account.group_account_manager 1 1 1 1
4 access_account_followup_followup_accountant account_followup.followup user model_account_followup_followup account.group_account_invoice 1 0 0 0
5 access_account_followup_followup_manager account_followup.followup.manager model_account_followup_followup account.group_account_manager 1 1 1 1
6 access_account_followup_stat_invoice account_followup.stat.invoice model_account_followup_stat account.group_account_invoice 1 1 1 0 1 0
7 access_account_followup_stat_by_partner_manager account_followup.stat.by.partner model_account_followup_stat_by_partner account.group_account_user 1 1 1 0 1 0

View File

@ -88,6 +88,7 @@ class payment_order_create(osv.osv_memory):
'order_id': payment.id, 'order_id': payment.id,
'partner_id': line.partner_id and line.partner_id.id or False, 'partner_id': line.partner_id and line.partner_id.id or False,
'communication': line.ref or '/', 'communication': line.ref or '/',
'state': line.invoice and line.invoice.reference_type != 'none' and 'structured' or 'normal',
'date': date_to_pay, 'date': date_to_pay,
'currency': (line.invoice and line.invoice.currency_id.id) or line.journal_id.currency.id or line.journal_id.company_id.currency_id.id, 'currency': (line.invoice and line.invoice.currency_id.id) or line.journal_id.currency.id or line.journal_id.company_id.currency_id.id,
}, context=context) }, context=context)

View File

@ -1622,7 +1622,7 @@ class account_bank_statement(osv.osv):
for bk_st in self.browse(cr, uid, ids, context=context): for bk_st in self.browse(cr, uid, ids, context=context):
if vals.get('journal_id') and bk_st.line_ids: if vals.get('journal_id') and bk_st.line_ids:
if any([x.voucher_id and True or False for x in bk_st.line_ids]): if any([x.voucher_id and True or False for x in bk_st.line_ids]):
raise osv.except_osv(_('Unable to change journal !'), _('You can not change the journal as you already reconciled some statement lines!')) raise osv.except_osv(_('Unable to Change Journal!'), _('You can not change the journal as you already reconciled some statement lines!'))
return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)

View File

@ -157,7 +157,7 @@ class account_analytic_account(osv.osv):
for account in self.browse(cr, uid, ids, context=context): for account in self.browse(cr, uid, ids, context=context):
if account.company_id: if account.company_id:
if account.company_id.currency_id.id != value: if account.company_id.currency_id.id != value:
raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really usefull for consolidation purposes of several companies charts with different currencies, for example.")) raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really useful for consolidation purposes of several companies charts with different currencies, for example."))
if value: if value:
return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, )) return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, ))

View File

@ -104,7 +104,7 @@ class hr_analytic_timesheet(osv.osv):
a = r.product_id.categ_id.property_account_expense_categ.id a = r.product_id.categ_id.property_account_expense_categ.id
if not a: if not a:
raise osv.except_osv(_('Error!'), raise osv.except_osv(_('Error!'),
_('There is no expense account define ' \ _('There is no expense account defined ' \
'for this product: "%s" (id:%d)') % \ 'for this product: "%s" (id:%d)') % \
(r.product_id.name, r.product_id.id,)) (r.product_id.name, r.product_id.id,))
# Compute based on pricetype # Compute based on pricetype
@ -133,7 +133,7 @@ class hr_analytic_timesheet(osv.osv):
a = r.product_id.categ_id.property_account_expense_categ.id a = r.product_id.categ_id.property_account_expense_categ.id
if not a: if not a:
raise osv.except_osv(_('Error!'), raise osv.except_osv(_('Error!'),
_('There is no expense account define ' \ _('There is no expense account defined ' \
'for this product: "%s" (id:%d)') % \ 'for this product: "%s" (id:%d)') % \
(r.product_id.name, r.product_id.id,)) (r.product_id.name, r.product_id.id,))
# Compute based on pricetype # Compute based on pricetype

View File

@ -86,11 +86,11 @@ class ir_model_fields_anonymization(osv.osv):
if context.get('manual'): if context.get('manual'):
global_state = self._get_global_state(cr, uid, context=context) global_state = self._get_global_state(cr, uid, context=context)
if global_state == 'anonymized': if global_state == 'anonymized':
raise osv.except_osv('Error !', "The database is currently anonymized, you cannot create, modify or delete fields.") raise osv.except_osv('Error!', "The database is currently anonymized, you cannot create, modify or delete fields.")
elif global_state == 'unstable': elif global_state == 'unstable':
msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \
" while some fields are not anonymized. You should try to solve this problem before trying to create, write or delete fields.") " while some fields are not anonymized. You should try to solve this problem before trying to create, write or delete fields.")
raise osv.except_osv('Error !', msg) raise osv.except_osv('Error!', msg)
return True return True
@ -357,7 +357,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
else: else:
msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \
" while some fields are not anonymized. You should try to solve this problem before trying to do anything else.") " while some fields are not anonymized. You should try to solve this problem before trying to do anything else.")
raise osv.except_osv('Error !', msg) raise osv.except_osv('Error!', msg)
res['arch'] = etree.tostring(eview) res['arch'] = etree.tostring(eview)
@ -521,11 +521,11 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
# check that all the defined fields are in the 'anonymized' state # check that all the defined fields are in the 'anonymized' state
state = ir_model_fields_anonymization_model._get_global_state(cr, uid, context=context) state = ir_model_fields_anonymization_model._get_global_state(cr, uid, context=context)
if state == 'clear': if state == 'clear':
raise osv.except_osv_('Error !', "The database is not currently anonymized, you cannot reverse the anonymization.") raise osv.except_osv_('Error!', "The database is not currently anonymized, you cannot reverse the anonymization.")
elif state == 'unstable': elif state == 'unstable':
msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \
" while some fields are not anonymized. You should try to solve this problem before trying to do anything.") " while some fields are not anonymized. You should try to solve this problem before trying to do anything.")
raise osv.except_osv('Error !', msg) raise osv.except_osv('Error!', msg)
wizards = self.browse(cr, uid, ids, context=context) wizards = self.browse(cr, uid, ids, context=context)
for wizard in wizards: for wizard in wizards:

View File

@ -102,7 +102,10 @@ class OAuthController(oeweb.Controller):
registry = RegistryManager.get(dbname) registry = RegistryManager.get(dbname)
with registry.cursor() as cr: with registry.cursor() as cr:
IMD = registry['ir.model.data'] IMD = registry['ir.model.data']
model, provider_id = IMD.get_object_reference(cr, SUPERUSER_ID, 'auth_oauth', 'provider_openerp') try:
model, provider_id = IMD.get_object_reference(cr, SUPERUSER_ID, 'auth_oauth', 'provider_openerp')
except ValueError:
return set_cookie_and_redirect(req, '/?db=%s' % dbname)
assert model == 'auth.oauth.provider' assert model == 'auth.oauth.provider'
state = { state = {

View File

@ -0,0 +1,9 @@
Name,Is a company,Related company,Address type,Customer,Supplier,Street,ZIP,City,State,Country
Aurora Shelves,1,,,1,0,25 Pacific Road,95101,San José,CA,United States
Roger Martins,0,Aurora Shelves,Invoice,1,0,27 Pacific Road,95102,San José,CA,United States
House Sales Direct,1,,,1,0,104 Saint Mary Avenue,94059,Redwood,CA,United States
Yvan Holiday,0,House Sales Direct,Default,1,0,104 Saint Mary Avenue,94060,Redwood,CA,United States
Jack Unsworth,0,House Sales Direct,Invoice,1,0,227 Jackson Road,94061,Redwood,CA,United States
Michael Mason,0,,,1,0,16 5th Avenue,94104,San Francisco,CA,United States
International Wood,1,,,1,0,748 White House Boulevard,20004,Washington,DC,United States
Sharon Pecker,0,International Wood,Invoice,1,0,755 White House Boulevard,20005,Washington,DC,United States
1 Name Is a company Related company Address type Customer Supplier Street ZIP City State Country
2 Aurora Shelves 1 1 0 25 Pacific Road 95101 San José CA United States
3 Roger Martins 0 Aurora Shelves Invoice 1 0 27 Pacific Road 95102 San José CA United States
4 House Sales Direct 1 1 0 104 Saint Mary Avenue 94059 Redwood CA United States
5 Yvan Holiday 0 House Sales Direct Default 1 0 104 Saint Mary Avenue 94060 Redwood CA United States
6 Jack Unsworth 0 House Sales Direct Invoice 1 0 227 Jackson Road 94061 Redwood CA United States
7 Michael Mason 0 1 0 16 5th Avenue 94104 San Francisco CA United States
8 International Wood 1 1 0 748 White House Boulevard 20004 Washington DC United States
9 Sharon Pecker 0 International Wood Invoice 1 0 755 White House Boulevard 20005 Washington DC United States

View File

@ -1,8 +0,0 @@
Name,Address type,Street,City,Country,Tags,Supplier,Customer,Is a company,Companies that refers to partner / Parent company
Wood y Wood Pecker,,"Snow Street, 25",Kainuu,Finland,Supplier,1,0,1,
Roger Pecker,Default,"Snow Street, 27",Kainuu,Finland,Supplier,1,0,0,Wood y Wood Pecker
Sharon Pecker,Delivery,"Snow Street, 28",Kainuu,Finland,Supplier,1,0,0,Wood y Wood Pecker
Thomas Pecker,Contact,"Snow Street, 27",Kainuu,Finland,Supplier,1,0,0,Wood y Wood Pecker
Vicking Direct,,"Atonium Street, 45a",Brussels,Belgium,Supplier,1,0,1,
Yvan Holiday,Invoice,"Atonium Street, 45b",Brussels,Belgium,Supplier,1,0,0,Vicking Direct
Jack Unsworth,Contact,"Atonium Street, 45a",Brussels,Belgium,Supplier,1,0,0,Vicking Direct
1 Name Address type Street City Country Tags Supplier Customer Is a company Companies that refers to partner / Parent company
2 Wood y Wood Pecker Snow Street, 25 Kainuu Finland Supplier 1 0 1
3 Roger Pecker Default Snow Street, 27 Kainuu Finland Supplier 1 0 0 Wood y Wood Pecker
4 Sharon Pecker Delivery Snow Street, 28 Kainuu Finland Supplier 1 0 0 Wood y Wood Pecker
5 Thomas Pecker Contact Snow Street, 27 Kainuu Finland Supplier 1 0 0 Wood y Wood Pecker
6 Vicking Direct Atonium Street, 45a Brussels Belgium Supplier 1 0 1
7 Yvan Holiday Invoice Atonium Street, 45b Brussels Belgium Supplier 1 0 0 Vicking Direct
8 Jack Unsworth Contact Atonium Street, 45a Brussels Belgium Supplier 1 0 0 Vicking Direct

View File

@ -229,8 +229,8 @@
orders with their respective purchase order lines:</p> orders with their respective purchase order lines:</p>
<a href="/base_import/static/csv/o2m_purchase_order_lines.csv">Purchase orders with their respective purchase order lines</a> <a href="/base_import/static/csv/o2m_purchase_order_lines.csv">Purchase orders with their respective purchase order lines</a>
<p>The following CSV file shows how to import <p>The following CSV file shows how to import
suppliers and their respective contacts</p> customers and their respective contacts</p>
<a href="/base_import/static/csv/o2m_suppliers_contacts.csv">Suppliers and their respective contacts</a> <a href="/base_import/static/csv/o2m_customers_contacts.csv">Customers and their respective contacts</a>
</dd> </dd>
</dl> </dl>

View File

@ -61,8 +61,8 @@ class RPCSession(object):
protocol = m.group(1) protocol = m.group(1)
if not m: if not m:
return -1 return -1
if protocol == 'http://' or protocol == 'http://': if protocol == 'http://' or protocol == 'https://':
self.gateway = XMLRPCGateway(host, port, 'http') self.gateway = XMLRPCGateway(host, port, protocol[:-3])
elif protocol == 'socket://': elif protocol == 'socket://':
self.gateway = NETRPCGateway(host, port) self.gateway = NETRPCGateway(host, port)

View File

@ -104,7 +104,7 @@ class base_state(object):
if parent_id.change_responsible and parent_id.user_id: if parent_id.change_responsible and parent_id.user_id:
data['user_id'] = parent_id.user_id.id data['user_id'] = parent_id.user_id.id
else: else:
raise osv.except_osv(_('Error !'), _('You can not escalate, you are already at the top level regarding your sales-team category.')) raise osv.except_osv(_('Error!'), _('You can not escalate, you are already at the top level regarding your sales-team category.'))
self.write(cr, uid, [case.id], data, context=context) self.write(cr, uid, [case.id], data, context=context)
case.case_escalate_send_note(parent_id, context=context) case.case_escalate_send_note(parent_id, context=context)
return True return True

View File

@ -344,7 +344,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
}, },
load_data:function(){ load_data:function(){
var board = new instance.web.Model('board.board'); var board = new instance.web.Model('board.board');
return board.call('list'); return board.call('list', [board.context()]);
}, },
_x:function() { _x:function() {
if (!instance.webclient) { return $.Deferred().reject(); } if (!instance.webclient) { return $.Deferred().reject(); }

View File

@ -86,7 +86,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
lead_obj = self.pool.get('crm.lead') lead_obj = self.pool.get('crm.lead')
for lead in lead_obj.browse(cr, uid, context.get('active_ids', []), context=context): for lead in lead_obj.browse(cr, uid, context.get('active_ids', []), context=context):
if lead.state in ['done', 'cancel']: if lead.state in ['done', 'cancel']:
raise osv.except_osv(_("Warning !"), _("Closed/Cancelled leads cannot be converted into opportunities.")) raise osv.except_osv(_("Warning!"), _("Closed/Cancelled leads cannot be converted into opportunities."))
return False return False
def _convert_opportunity(self, cr, uid, ids, vals, context=None): def _convert_opportunity(self, cr, uid, ids, vals, context=None):

View File

@ -15,7 +15,11 @@
<field name="view_id" ref="crm_case_claims_tree_view"/> <field name="view_id" ref="crm_case_claims_tree_view"/>
<field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field> <field name="context">{"search_default_user_id":uid, "stage_type":'claim'}</field>
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter"/> <field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="help">Record and track your customers' claims. Claims may be linked to a sales order or a lot. You can send emails with attachments and keep the full history for a claim (emails sent, intervention type and so on). Claims may automatically be linked to an email address using the mail gateway module.</field> <field name="help" type="html">
<p class="oe_view_nocontent_create">
Record and track your customers' claims. Claims may be linked to a sales order or a lot.You can send emails with attachments and keep the full history for a claim (emails sent, intervention type and so on).Claims may automatically be linked to an email address using the mail gateway module.
</p>
</field>
</record> </record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_claim0"> <record model="ir.actions.act_window.view" id="action_crm_tag_tree_claim0">

View File

@ -51,10 +51,10 @@ class sale_order(osv.osv):
for order in self.browse(cr, uid, ids, context=context): for order in self.browse(cr, uid, ids, context=context):
grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id) grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id)
if not grid_id: if not grid_id:
raise osv.except_osv(_('No grid available !'), _('No grid matching for this carrier !')) raise osv.except_osv(_('No Grid Available!'), _('No grid matching for this carrier!'))
if not order.state in ('draft'): if not order.state in ('draft'):
raise osv.except_osv(_('Order not in draft state !'), _('The order state have to be draft to add delivery lines.')) raise osv.except_osv(_('Order not in Draft State!'), _('The order state have to be draft to add delivery lines.'))
grid = grid_obj.browse(cr, uid, grid_id, context=context) grid = grid_obj.browse(cr, uid, grid_id, context=context)

View File

@ -88,7 +88,11 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="view_wiki_tree"/> <field name="view_id" ref="view_wiki_tree"/>
<field name="search_view_id" ref="view_wiki_filter"/> <field name="search_view_id" ref="view_wiki_filter"/>
<field name="help">Create web pages</field> <field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new web page.
</p>
</field>
</record> </record>
<menuitem id="menu_page" parent="menu_wiki" name="Pages" action="action_page" sequence="10"/> <menuitem id="menu_page" parent="menu_wiki" name="Pages" action="action_page" sequence="10"/>
<record id="action_category" model="ir.actions.act_window"> <record id="action_category" model="ir.actions.act_window">

View File

@ -126,7 +126,7 @@ class edi(osv.AbstractModel):
module = edi_document.get('__import_module') or edi_document.get('__module') module = edi_document.get('__import_module') or edi_document.get('__module')
assert module, 'a `__module` or `__import_module` attribute is required in each EDI document.' assert module, 'a `__module` or `__import_module` attribute is required in each EDI document.'
if module != 'base' and not ir_module.search(cr, uid, [('name','=',module),('state','=','installed')]): if module != 'base' and not ir_module.search(cr, uid, [('name','=',module),('state','=','installed')]):
raise osv.except_osv(_('Missing application.'), raise osv.except_osv(_('Missing Application.'),
_("The document you are trying to import requires the OpenERP `%s` application. " _("The document you are trying to import requires the OpenERP `%s` application. "
"You can install it by connecting as the administrator and opening the configuration assistant.")%(module,)) "You can install it by connecting as the administrator and opening the configuration assistant.")%(module,))
model = edi_document.get('__import_model') or edi_document.get('__model') model = edi_document.get('__import_model') or edi_document.get('__model')

View File

@ -591,6 +591,9 @@
<field name="view_mode">tree,graph</field> <field name="view_mode">tree,graph</field>
<field name="context">{"search_default_groupby_vehicle" : True}</field> <field name="context">{"search_default_groupby_vehicle" : True}</field>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new odometer log.
</p>
<p> <p>
Here you can add various odometer entries for all vehicles. Here you can add various odometer entries for all vehicles.
You can also show odometer value for a particular vehicle using You can also show odometer value for a particular vehicle using

View File

@ -46,7 +46,7 @@ class hr_attendance_error(osv.osv_memory):
cr.execute("SELECT id FROM hr_attendance WHERE employee_id IN %s AND to_char(name,'YYYY-mm-dd')<=%s AND to_char(name,'YYYY-mm-dd')>=%s AND action IN %s ORDER BY name" ,(tuple(context['active_ids']), date_to, date_from, tuple(['sign_in','sign_out']))) cr.execute("SELECT id FROM hr_attendance WHERE employee_id IN %s AND to_char(name,'YYYY-mm-dd')<=%s AND to_char(name,'YYYY-mm-dd')>=%s AND action IN %s ORDER BY name" ,(tuple(context['active_ids']), date_to, date_from, tuple(['sign_in','sign_out'])))
attendance_ids = [x[0] for x in cr.fetchall()] attendance_ids = [x[0] for x in cr.fetchall()]
if not attendance_ids: if not attendance_ids:
raise osv.except_osv(_('No Data Available !'), _('No records are found for your selection!')) raise osv.except_osv(_('No Data Available!'), _('No records are found for your selection!'))
attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids, context=context) attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids, context=context)
for rec in attendance_records: for rec in attendance_records:

View File

@ -210,6 +210,11 @@
<field name="context">{"default_hr_expense_ok":1}</field> <field name="context">{"default_hr_expense_ok":1}</field>
<field name="domain">[('hr_expense_ok','=',True)]</field> <field name="domain">[('hr_expense_ok','=',True)]</field>
<field name="search_view_id" ref="product.product_search_form_view"/> <field name="search_view_id" ref="product.product_search_form_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new expense category.
</p>
</field>
</record> </record>
<menuitem id="menu_hr_product" name="Expense Categories" parent="hr.menu_hr_configuration" action="hr_expense_product"/> <menuitem id="menu_hr_product" name="Expense Categories" parent="hr.menu_hr_configuration" action="hr_expense_product"/>

View File

@ -146,6 +146,7 @@
<field name="number_of_days" string="Allocated Days" sum="Remaining Days"/> <field name="number_of_days" string="Allocated Days" sum="Remaining Days"/>
<field name="manager_id" invisible="1"/> <field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/> <field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<!--field name="type"/--> <!--field name="type"/-->
<field name="state"/> <field name="state"/>
</tree> </tree>

View File

@ -49,7 +49,7 @@ class hr_payslip_employees(osv.osv_memory):
to_date = run_data.get('date_end', False) to_date = run_data.get('date_end', False)
credit_note = run_data.get('credit_note', False) credit_note = run_data.get('credit_note', False)
if not data['employee_ids']: if not data['employee_ids']:
raise osv.except_osv(_("Warning !"), _("You must select employee(s) to generate payslip(s).")) raise osv.except_osv(_("Warning!"), _("You must select employee(s) to generate payslip(s)."))
for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context): for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context):
slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False, context=context) slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False, context=context)
res = { res = {

View File

@ -181,7 +181,7 @@ class account_analytic_line(osv.osv):
for account in analytic_account_obj.browse(cr, uid, list(account_ids), context=context): for account in analytic_account_obj.browse(cr, uid, list(account_ids), context=context):
partner = account.partner_id partner = account.partner_id
if (not partner) or not (account.pricelist_id): if (not partner) or not (account.pricelist_id):
raise osv.except_osv(_('Analytic Account incomplete !'), raise osv.except_osv(_('Analytic Account Incomplete!'),
_('Contract incomplete. Please fill in the Customer and Pricelist fields.')) _('Contract incomplete. Please fill in the Customer and Pricelist fields.'))
date_due = False date_due = False

View File

@ -16,7 +16,7 @@
<field name="name">timesheet.report.tree</field> <field name="name">timesheet.report.tree</field>
<field name="model">timesheet.report</field> <field name="model">timesheet.report</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'cancel'" string="Timesheet"> <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'cancel'" string="Timesheet" create="false">
<field name="date" invisible="1"/> <field name="date" invisible="1"/>
<field name="name" invisible="1"/> <field name="name" invisible="1"/>
<field name="user_id" invisible="1"/> <field name="user_id" invisible="1"/>

View File

@ -3,7 +3,7 @@ access_hr_timesheet_sheet_sheet_user,hr_timesheet_sheet.sheet.user,model_hr_time
access_hr_timesheet_sheet_sheet_system_employee,hr_timesheet_sheet.sheet.system.employee,model_hr_timesheet_sheet_sheet,base.group_user,1,1,1,0 access_hr_timesheet_sheet_sheet_system_employee,hr_timesheet_sheet.sheet.system.employee,model_hr_timesheet_sheet_sheet,base.group_user,1,1,1,0
access_hr_timesheet_sheet_sheet_day,hr_timesheet_sheet.sheet.day,model_hr_timesheet_sheet_sheet_day,base.group_hr_user,1,1,1,1 access_hr_timesheet_sheet_sheet_day,hr_timesheet_sheet.sheet.day,model_hr_timesheet_sheet_sheet_day,base.group_hr_user,1,1,1,1
access_hr_timesheet_sheet_sheet_account,hr_timesheet_sheet.sheet.account,model_hr_timesheet_sheet_sheet_account,base.group_hr_user,1,1,1,1 access_hr_timesheet_sheet_sheet_account,hr_timesheet_sheet.sheet.account,model_hr_timesheet_sheet_sheet_account,base.group_hr_user,1,1,1,1
access_hr_timesheet_report,hr.timesheet.report,model_hr_timesheet_report,base.group_hr_manager,1,1,1,1 access_hr_timesheet_report,hr.timesheet.report,model_hr_timesheet_report,base.group_hr_manager,1,1,0,0
access_hr_analytic_timesheet_system_user,hr.analytic.timesheet.system.user,model_hr_analytic_timesheet,base.group_user,1,0,0,0 access_hr_analytic_timesheet_system_user,hr.analytic.timesheet.system.user,model_hr_analytic_timesheet,base.group_user,1,0,0,0
access_hr_timesheet_sheet_sheet_day,hr.timesheet.sheet.sheet.day.user,model_hr_timesheet_sheet_sheet_day,base.group_user,1,1,1,0 access_hr_timesheet_sheet_sheet_day,hr.timesheet.sheet.sheet.day.user,model_hr_timesheet_sheet_sheet_day,base.group_user,1,1,1,0
access_timesheet_report,timesheet.report,model_timesheet_report,base.group_hr_manager,1,1,1,1 access_timesheet_report,timesheet.report,model_timesheet_report,base.group_hr_manager,1,1,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_hr_timesheet_sheet_sheet_system_employee hr_timesheet_sheet.sheet.system.employee model_hr_timesheet_sheet_sheet base.group_user 1 1 1 0
4 access_hr_timesheet_sheet_sheet_day hr_timesheet_sheet.sheet.day model_hr_timesheet_sheet_sheet_day base.group_hr_user 1 1 1 1
5 access_hr_timesheet_sheet_sheet_account hr_timesheet_sheet.sheet.account model_hr_timesheet_sheet_sheet_account base.group_hr_user 1 1 1 1
6 access_hr_timesheet_report hr.timesheet.report model_hr_timesheet_report base.group_hr_manager 1 1 1 0 1 0
7 access_hr_analytic_timesheet_system_user hr.analytic.timesheet.system.user model_hr_analytic_timesheet base.group_user 1 0 0 0
8 access_hr_timesheet_sheet_sheet_day hr.timesheet.sheet.sheet.day.user model_hr_timesheet_sheet_sheet_day base.group_user 1 1 1 0
9 access_timesheet_report timesheet.report model_timesheet_report base.group_hr_manager 1 1 1 0 1 0

View File

@ -190,8 +190,13 @@ openerp.hr_timesheet_sheet = function(instance) {
$(this).val(self.sum_box(account, day_count, true)); $(this).val(self.sum_box(account, day_count, true));
} else { } else {
account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count); account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count);
self.display_totals(); var product = (account.days[day_count].lines[0].product_id instanceof Array) ? account.days[day_count].lines[0].product_id[0] : account.days[day_count].lines[0].product_id
self.sync(); var journal = (account.days[day_count].lines[0].journal_id instanceof Array) ? account.days[day_count].lines[0].journal_id[0] : account.days[day_count].lines[0].journal_id
new instance.web.Model("hr.analytic.timesheet").call("on_change_unit_amount", [[], product, account.days[day_count].lines[0].unit_amount, false, false, journal]).then(function(res) {
account.days[day_count].lines[0]['amount'] = res.value.amount || 0;
self.display_totals();
self.sync();
});
if(!isNaN($(this).val())){ if(!isNaN($(this).val())){
$(this).val(self.sum_box(account, day_count, true)); $(this).val(self.sum_box(account, day_count, true));
} }
@ -308,10 +313,10 @@ openerp.hr_timesheet_sheet = function(instance) {
generate_o2m_value: function() { generate_o2m_value: function() {
var self = this; var self = this;
var ops = []; var ops = [];
_.each(self.accounts, function(account) { _.each(self.accounts, function(account) {
var auth_keys = _.extend(_.clone(account.account_defaults), { var auth_keys = _.extend(_.clone(account.account_defaults), {
name: true, unit_amount: true, date: true, account_id:true, name: true, amount:true, unit_amount: true, date: true, account_id:true,
}); });
_.each(account.days, function(day) { _.each(account.days, function(day) {
_.each(day.lines, function(line) { _.each(day.lines, function(line) {

View File

@ -84,7 +84,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
obj_company = obj_user.browse(cr, uid, uid, context=context).company_id obj_company = obj_user.browse(cr, uid, uid, context=context).company_id
vat_no = obj_company.partner_id.vat vat_no = obj_company.partner_id.vat
if not vat_no: if not vat_no:
raise osv.except_osv(_('insufficient data!'), _('No VAT number associated with your company.')) raise osv.except_osv(_('Insufficient Data!'), _('No VAT number associated with your company.'))
vat_no = vat_no.replace(' ','').upper() vat_no = vat_no.replace(' ','').upper()
vat = vat_no[2:] vat = vat_no[2:]

View File

@ -60,12 +60,12 @@ class partner_vat(osv.osv_memory):
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
period_ids = obj_period.search(cr, uid, [('date_start' ,'>=', date_start), ('date_stop','<=',date_stop), ('company_id','=',company_id)]) period_ids = obj_period.search(cr, uid, [('date_start' ,'>=', date_start), ('date_stop','<=',date_stop), ('company_id','=',company_id)])
if not period_ids: if not period_ids:
raise osv.except_osv(_('insufficient data!'), _('No data for the selected year.')) raise osv.except_osv(_('Insufficient Data!'), _('No data for the selected year.'))
partners = [] partners = []
partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context) partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)
if not partner_ids: if not partner_ids:
raise osv.except_osv(_('Error'),_('No belgian contact with a VAT number in your database.')) raise osv.except_osv(_('Error'),_('No belgium contact with a VAT number in your database.'))
cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount
FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover
FROM account_move_line l FROM account_move_line l
@ -90,7 +90,7 @@ class partner_vat(osv.osv_memory):
partners.append(id_client) partners.append(id_client)
if not partners: if not partners:
raise osv.except_osv(_('insufficient data!'), _('No data found for the selected year.')) raise osv.except_osv(_('Insufficient Data!'), _('No data found for the selected year.'))
context.update({'partner_ids': partners, 'year': data['year'], 'limit_amount': data['limit_amount']}) context.update({'partner_ids': partners, 'year': data['year'], 'limit_amount': data['limit_amount']})
model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','view_vat_listing')]) model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','view_vat_listing')])
resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']

View File

@ -108,7 +108,7 @@ class partner_vat_intra(osv.osv_memory):
# Get Company vat # Get Company vat
company_vat = data_company.partner_id.vat company_vat = data_company.partner_id.vat
if not company_vat: if not company_vat:
raise osv.except_osv(_('insufficient data!'),_('No VAT number associated with your company.')) raise osv.except_osv(_('Insufficient Data!'),_('No VAT number associated with your company.'))
company_vat = company_vat.replace(' ','').upper() company_vat = company_vat.replace(' ','').upper()
issued_by = company_vat[:2] issued_by = company_vat[:2]
@ -120,7 +120,7 @@ class partner_vat_intra(osv.osv_memory):
p_id_list = obj_partner.search(cr, uid, [('vat','!=',False)], context=context) p_id_list = obj_partner.search(cr, uid, [('vat','!=',False)], context=context)
if not p_id_list: if not p_id_list:
raise osv.except_osv(_('Insufficient Data!'),_('No partner has a VAT number asociated with him.')) raise osv.except_osv(_('Insufficient Data!'),_('No partner has a VAT number associated with him.'))
seq_declarantnum = obj_sequence.get(cr, uid, 'declarantnum') seq_declarantnum = obj_sequence.get(cr, uid, 'declarantnum')
dnum = company_vat[2:] + seq_declarantnum[-4:] dnum = company_vat[2:] + seq_declarantnum[-4:]

View File

@ -35,24 +35,24 @@
</form> </form>
</field> </field>
</record> </record>
<record id="view_account_bank_statement_line_coda_tree" model="ir.ui.view"> <record id="view_account_bank_statement_line_coda_tree" model="ir.ui.view">
<field name="name">account.bank.statement.line.coda.tree</field> <field name="name">account.bank.statement.line.coda.tree</field>
<field name="model">account.bank.statement.line</field> <field name="model">account.bank.statement.line</field>
<field name="priority">10</field> <field name="priority">10</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree editable="bottom" string="Statement lines"> <tree editable="bottom" string="Statement lines" create="0">
<field name="statement_id" readonly="1" invisible="1"/> <field name="sequence" readonly="1" invisible="1"/>
<field name="sequence" readonly="1" invisible="1"/> <field name="statement_id" readonly="1" />
<field name="date"/> <field name="date"/>
<field name="name"/> <field name="name"/>
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/> <field name="account_id" options='{"no_open":True}' domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/> <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/> <field name="amount"/>
<field name="note"/> <field name="note"/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -103,7 +103,7 @@ class payroll_advice(osv.osv):
slip_ids = payslip_pool.search(cr, uid, [('date_from', '<=', advice.date), ('date_to', '>=', advice.date), ('state', '=', 'done')], context=context) slip_ids = payslip_pool.search(cr, uid, [('date_from', '<=', advice.date), ('date_to', '>=', advice.date), ('state', '=', 'done')], context=context)
for slip in payslip_pool.browse(cr, uid, slip_ids, context=context): for slip in payslip_pool.browse(cr, uid, slip_ids, context=context):
if not slip.employee_id.bank_account_id and not slip.employee_id.bank_account_id.acc_number: if not slip.employee_id.bank_account_id and not slip.employee_id.bank_account_id.acc_number:
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) raise osv.except_osv(_('Error!'), _('Please define bank account for the %s employee') % (slip.employee_id.name))
line_ids = payslip_line_pool.search(cr, uid, [ ('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context) line_ids = payslip_line_pool.search(cr, uid, [ ('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context)
if line_ids: if line_ids:
line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0] line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0]
@ -129,7 +129,7 @@ class payroll_advice(osv.osv):
seq_obj = self.pool.get('ir.sequence') seq_obj = self.pool.get('ir.sequence')
for advice in self.browse(cr, uid, ids, context=context): for advice in self.browse(cr, uid, ids, context=context):
if not advice.line_ids: if not advice.line_ids:
raise osv.except_osv(_('Error !'), _('You can not confirm Payment advice without advice lines.')) raise osv.except_osv(_('Error!'), _('You can not confirm Payment advice without advice lines.'))
advice_date = datetime.strptime(advice.date, DATETIME_FORMAT) advice_date = datetime.strptime(advice.date, DATETIME_FORMAT)
advice_year = advice_date.strftime('%m') + '-' + advice_date.strftime('%Y') advice_year = advice_date.strftime('%m') + '-' + advice_date.strftime('%Y')
number = seq_obj.get(cr, uid, 'payment.advice') number = seq_obj.get(cr, uid, 'payment.advice')
@ -183,7 +183,7 @@ class hr_payslip_run(osv.osv):
users = self.pool.get('res.users').browse(cr, uid, [uid], context=context) users = self.pool.get('res.users').browse(cr, uid, [uid], context=context)
for run in self.browse(cr, uid, ids, context=context): for run in self.browse(cr, uid, ids, context=context):
if run.available_advice: if run.available_advice:
raise osv.except_osv(_('Error !'), _("Payment advice already exists for %s, 'Set to Draft' to create a new advice.") %(run.name)) raise osv.except_osv(_('Error!'), _("Payment advice already exists for %s, 'Set to Draft' to create a new advice.") %(run.name))
advice_data = { advice_data = {
'batch_id': run.id, 'batch_id': run.id,
'company_id': users[0].company_id.id, 'company_id': users[0].company_id.id,
@ -201,7 +201,7 @@ class hr_payslip_run(osv.osv):
for slip in payslip_pool.browse(cr, uid, slip_ids, context=context): for slip in payslip_pool.browse(cr, uid, slip_ids, context=context):
if not slip.employee_id.bank_account_id or not slip.employee_id.bank_account_id.acc_number: if not slip.employee_id.bank_account_id or not slip.employee_id.bank_account_id.acc_number:
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) raise osv.except_osv(_('Error!'), _('Please define bank account for the %s employee') % (slip.employee_id.name))
line_ids = payslip_line_pool.search(cr, uid, [('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context) line_ids = payslip_line_pool.search(cr, uid, [('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context)
if line_ids: if line_ids:
line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0] line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0]

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ class report_custom(report_int):
self.obj.render() self.obj.render()
return (self.obj.pdf, 'pdf') return (self.obj.pdf, 'pdf')
except Exception: except Exception:
raise osv.except_osv(_('pdf not created !'), _('Please check if package pdftk is installed!')) raise osv.except_osv(_('PDF Not Created!'), _('Please check if package pdftk is installed!'))
report_custom('report.l10n_lu.tax.report.print') report_custom('report.l10n_lu.tax.report.print')

View File

@ -495,7 +495,7 @@ class mail_thread(osv.AbstractModel):
ret_dict = {} ret_dict = {}
for model_name in self.pool.obj_list(): for model_name in self.pool.obj_list():
model = self.pool[model_name] model = self.pool[model_name]
if 'mail.thread' in getattr(model, '_inherit', []): if hasattr(model, "message_process") and hasattr(model, "message_post"):
ret_dict[model_name] = model._description ret_dict[model_name] = model._description
return ret_dict return ret_dict
@ -1226,7 +1226,10 @@ class mail_thread(osv.AbstractModel):
def message_subscribe(self, cr, uid, ids, partner_ids, subtype_ids=None, context=None): def message_subscribe(self, cr, uid, ids, partner_ids, subtype_ids=None, context=None):
""" Add partners to the records followers. """ """ Add partners to the records followers. """
user_pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0] mail_followers_obj = self.pool.get('mail.followers')
subtype_obj = self.pool.get('mail.message.subtype')
user_pid = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id
if set(partner_ids) == set([user_pid]): if set(partner_ids) == set([user_pid]):
try: try:
self.check_access_rights(cr, uid, 'read') self.check_access_rights(cr, uid, 'read')
@ -1235,27 +1238,35 @@ class mail_thread(osv.AbstractModel):
else: else:
self.check_access_rights(cr, uid, 'write') self.check_access_rights(cr, uid, 'write')
# subscribe partners for record in self.browse(cr, SUPERUSER_ID, ids, context=context):
self.write(cr, SUPERUSER_ID, ids, {'message_follower_ids': [(4, pid) for pid in partner_ids]}, context=context) existing_pids = set([f.id for f in record.message_follower_ids
if f.id in partner_ids])
new_pids = set(partner_ids) - existing_pids
# subtype specified: update the subscriptions # subtype_ids specified: update already subscribed partners
fol_obj = self.pool.get('mail.followers') if subtype_ids and existing_pids:
if subtype_ids is not None: fol_ids = mail_followers_obj.search(cr, SUPERUSER_ID, [
fol_ids = fol_obj.search(cr, SUPERUSER_ID, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context) ('res_model', '=', self._name),
fol_obj.write(cr, SUPERUSER_ID, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) ('res_id', '=', record.id),
# no subtypes: default ones for new subscription, do not update existing subscriptions ('partner_id', 'in', list(existing_pids)),
else: ], context=context)
# search new subscriptions: subtype_ids is False mail_followers_obj.write(cr, SUPERUSER_ID, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context)
fol_ids = fol_obj.search(cr, SUPERUSER_ID, [ # subtype_ids not specified: do not update already subscribed partner, fetch default subtypes for new partners
('res_model', '=', self._name), else:
('res_id', 'in', ids), subtype_ids = subtype_obj.search(cr, uid, [
('partner_id', 'in', partner_ids), ('default', '=', True),
('subtype_ids', '=', False) '|',
], context=context) ('res_model', '=', self._name),
if fol_ids: ('res_model', '=', False)
subtype_obj = self.pool.get('mail.message.subtype') ], context=context)
subtype_ids = subtype_obj.search(cr, uid, [('default', '=', True), '|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context) # subscribe new followers
fol_obj.write(cr, SUPERUSER_ID, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) for new_pid in new_pids:
mail_followers_obj.create(cr, SUPERUSER_ID, {
'res_model': self._name,
'res_id': record.id,
'partner_id': new_pid,
'subtype_ids': [(6, 0, subtype_ids)],
}, context=context)
return True return True

View File

@ -979,8 +979,8 @@ openerp.mail = function (session) {
expender: function () { expender: function () {
this.$('.oe_msg_body:first').expander({ this.$('.oe_msg_body:first').expander({
slicePoint: this.options.truncate_limit, slicePoint: this.options.truncate_limit,
expandText: 'read more', expandText: _t('read more'),
userCollapseText: 'read less', userCollapseText: _t('read less'),
detailClass: 'oe_msg_tail', detailClass: 'oe_msg_tail',
moreClass: 'oe_mail_expand', moreClass: 'oe_mail_expand',
lessClass: 'oe_mail_reduce', lessClass: 'oe_mail_reduce',

View File

@ -128,7 +128,7 @@ class mrp_production_workcenter_line(osv.osv):
elif prod_obj.state =='in_production': elif prod_obj.state =='in_production':
return return
else: else:
raise osv.except_osv(_('Error!'),_('Manufacturing order cannot start in state "%s"!') % (prod_obj.state,)) raise osv.except_osv(_('Error!'),_('Manufacturing order cannot be started in state "%s"!') % (prod_obj.state,))
else: else:
oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)]) oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)])
obj = self.browse(cr,uid,oper_ids) obj = self.browse(cr,uid,oper_ids)
@ -443,7 +443,7 @@ class mrp_operations_operation(osv.osv):
if not oper_objs: if not oper_objs:
if code.start_stop!='start': if code.start_stop!='start':
raise osv.except_osv(_('Sorry!'),_('Operation is not started yet !')) raise osv.except_osv(_('Sorry!'),_('Operation is not started yet!'))
return False return False
else: else:
for oper in oper_objs: for oper in oper_objs:

View File

@ -365,7 +365,7 @@ class mrp_repair(osv.osv):
if repair.state in ('draft','cancel') or repair.invoice_id: if repair.state in ('draft','cancel') or repair.invoice_id:
continue continue
if not (repair.partner_id.id and repair.partner_invoice_id.id): if not (repair.partner_id.id and repair.partner_invoice_id.id):
raise osv.except_osv(_('No partner !'),_('You have to select a Partner Invoice Address in the repair form !')) raise osv.except_osv(_('No partner!'),_('You have to select a Partner Invoice Address in the repair form!'))
comment = repair.quotation_notes comment = repair.quotation_notes
if (repair.invoice_method != 'none'): if (repair.invoice_method != 'none'):
if group and repair.partner_invoice_id.id in invoices_group: if group and repair.partner_invoice_id.id in invoices_group:
@ -582,7 +582,7 @@ class ProductChangeMixin(object):
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
if not pricelist: if not pricelist:
warning = { warning = {
'title':'No Pricelist !', 'title':'No Pricelist!',
'message': 'message':
'You have to select a pricelist in the Repair form !\n' 'You have to select a pricelist in the Repair form !\n'
'Please set one before choosing a product.' 'Please set one before choosing a product.'

View File

@ -407,7 +407,7 @@ class pos_session(osv.osv):
# The pos manager can close statements with maximums. # The pos manager can close statements with maximums.
if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"): if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"):
raise osv.except_osv( _('Error!'), raise osv.except_osv( _('Error!'),
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff)) _("Your ending balance is too different from the theoretical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
if (st.journal_id.type not in ['bank', 'cash']): if (st.journal_id.type not in ['bank', 'cash']):
raise osv.except_osv(_('Error!'), raise osv.except_osv(_('Error!'),
_("The type of the journal for your payment method should be bank or cash ")) _("The type of the journal for your payment method should be bank or cash "))
@ -545,7 +545,7 @@ class pos_order(osv.osv):
def unlink(self, cr, uid, ids, context=None): def unlink(self, cr, uid, ids, context=None):
for rec in self.browse(cr, uid, ids, context=context): for rec in self.browse(cr, uid, ids, context=context):
if rec.state not in ('draft','cancel'): if rec.state not in ('draft','cancel'):
raise osv.except_osv(_('Unable to Delete !'), _('In order to delete a sale, it must be new or cancelled.')) raise osv.except_osv(_('Unable to Delete!'), _('In order to delete a sale, it must be new or cancelled.'))
return super(pos_order, self).unlink(cr, uid, ids, context=context) return super(pos_order, self).unlink(cr, uid, ids, context=context)
def onchange_partner_id(self, cr, uid, ids, part=False, context=None): def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
@ -1163,7 +1163,7 @@ class pos_order_line(osv.osv):
if not product_id: if not product_id:
return {} return {}
if not pricelist: if not pricelist:
raise osv.except_osv(_('No Pricelist !'), raise osv.except_osv(_('No Pricelist!'),
_('You have to select a pricelist in the sale form !\n' \ _('You have to select a pricelist in the sale form !\n' \
'Please set one before choosing a product.')) 'Please set one before choosing a product.'))

View File

@ -16,7 +16,8 @@
// hide()s // hide()s
function openerp_pos_screens(instance, module){ //module is instance.point_of_sale function openerp_pos_screens(instance, module){ //module is instance.point_of_sale
var QWeb = instance.web.qweb; var QWeb = instance.web.qweb,
_t = instance.web._t;
module.ScreenSelector = instance.web.Class.extend({ module.ScreenSelector = instance.web.Class.extend({
init: function(options){ init: function(options){
@ -264,7 +265,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
// we add the help button by default. we do this because the buttons are cleared on each refresh so that // we add the help button by default. we do this because the buttons are cleared on each refresh so that
// the button stay local to each screen // the button stay local to each screen
this.pos_widget.left_action_bar.add_new_button({ this.pos_widget.left_action_bar.add_new_button({
label: 'help', label: _t('Help'),
icon: '/point_of_sale/static/src/img/icons/png48/help.png', icon: '/point_of_sale/static/src/img/icons/png48/help.png',
click: function(){ self.help_button_action(); }, click: function(){ self.help_button_action(); },
}); });
@ -454,7 +455,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
},500); },500);
this.add_action_button({ this.add_action_button({
label: 'back', label: _t('Back'),
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){ click: function(){
clearInterval(this.intervalID); clearInterval(this.intervalID);
@ -483,7 +484,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.add_action_button({ this.add_action_button({
label: 'back', label: _t('Back'),
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){ click: function(){
self.pos_widget.screen_selector.set_current_screen(self.previous_screen); self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
@ -491,7 +492,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
}); });
this.validate_button = this.add_action_button({ this.validate_button = this.add_action_button({
label: 'Validate', label: _t('Validate'),
icon: '/point_of_sale/static/src/img/icons/png48/validate.png', icon: '/point_of_sale/static/src/img/icons/png48/validate.png',
click: function(){ click: function(){
self.order_product(); self.order_product();
@ -674,7 +675,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
} }
this.add_action_button({ this.add_action_button({
label: 'back', label: _t('Back'),
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){ click: function(){
self.queue.schedule(self.cancel); self.queue.schedule(self.cancel);
@ -714,7 +715,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
var self = this; var self = this;
this.add_action_button({ this.add_action_button({
label: 'help', label: _t('Help'),
icon: '/point_of_sale/static/src/img/icons/png48/help.png', icon: '/point_of_sale/static/src/img/icons/png48/help.png',
click: function(){ click: function(){
$('.goodbye-message').css({opacity:1}).hide(); $('.goodbye-message').css({opacity:1}).hide();
@ -768,7 +769,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
if(this.pos_widget.screen_selector.current_mode === 'client'){ if(this.pos_widget.screen_selector.current_mode === 'client'){
this.add_action_button({ this.add_action_button({
label: 'pay', label: _t('Pay'),
icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', icon: '/point_of_sale/static/src/img/icons/png48/go-next.png',
click: function(){ click: function(){
self.pos_widget.screen_selector.set_current_screen(self.client_next_screen); self.pos_widget.screen_selector.set_current_screen(self.client_next_screen);
@ -808,13 +809,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
var self = this; var self = this;
this.add_action_button({ this.add_action_button({
label: 'Print', label: _t('Print'),
icon: '/point_of_sale/static/src/img/icons/png48/printer.png', icon: '/point_of_sale/static/src/img/icons/png48/printer.png',
click: function(){ self.print(); }, click: function(){ self.print(); },
}); });
this.add_action_button({ this.add_action_button({
label: 'Next Order', label: _t('Next Order'),
icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', icon: '/point_of_sale/static/src/img/icons/png48/go-next.png',
click: function() { self.finishOrder(); }, click: function() { self.finishOrder(); },
}); });
@ -870,7 +871,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.set_numpad_state(this.pos_widget.numpad.state); this.set_numpad_state(this.pos_widget.numpad.state);
this.back_button = this.add_action_button({ this.back_button = this.add_action_button({
label: 'Back', label: _t('Back'),
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){ click: function(){
self.pos_widget.screen_selector.set_current_screen(self.back_screen); self.pos_widget.screen_selector.set_current_screen(self.back_screen);
@ -878,7 +879,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
}); });
this.validate_button = this.add_action_button({ this.validate_button = this.add_action_button({
label: 'Validate', label: _t('Validate'),
name: 'validation', name: 'validation',
icon: '/point_of_sale/static/src/img/icons/png48/validate.png', icon: '/point_of_sale/static/src/img/icons/png48/validate.png',
click: function(){ click: function(){

View File

@ -1,5 +1,6 @@
function openerp_pos_widgets(instance, module){ //module is instance.point_of_sale function openerp_pos_widgets(instance, module){ //module is instance.point_of_sale
var QWeb = instance.web.qweb; var QWeb = instance.web.qweb,
_t = instance.web._t;
// The ImageCache is used to hide the latency of the application cache on-disk access in chrome // The ImageCache is used to hide the latency of the application cache on-disk access in chrome
// that causes annoying flickering on product pictures. Why the hell a simple access to // that causes annoying flickering on product pictures. Why the hell a simple access to
@ -971,13 +972,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.onscreen_keyboard.appendTo($(".point-of-sale #content")); this.onscreen_keyboard.appendTo($(".point-of-sale #content"));
this.close_button = new module.HeaderButtonWidget(this,{ this.close_button = new module.HeaderButtonWidget(this,{
label:'Close', label: _t('Close'),
action: function(){ self.try_close(); }, action: function(){ self.try_close(); },
}); });
this.close_button.appendTo(this.$('#rightheader')); this.close_button.appendTo(this.$('#rightheader'));
this.client_button = new module.HeaderButtonWidget(this,{ this.client_button = new module.HeaderButtonWidget(this,{
label:'Self-Checkout', label: _t('Self-Checkout'),
action: function(){ self.screen_selector.set_user_mode('client'); }, action: function(){ self.screen_selector.set_user_mode('client'); },
}); });
this.client_button.appendTo(this.$('#rightheader')); this.client_button.appendTo(this.$('#rightheader'));

View File

@ -46,7 +46,7 @@ class pos_open_statement(osv.osv_memory):
st_ids = [] st_ids = []
j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context) j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context)
if not j_ids: if not j_ids:
raise osv.except_osv(_('No Cash Register Defined !'), _('You have to define which payment method must be available in the point of sale by reusing existing bank and cash through "Accounting / Configuration / Journals / Journals". Select a journal and check the field "PoS Payment Method" from the "Point of Sale" tab. You can also create new payment methods directly from menu "PoS Backend / Configuration / Payment Methods".')) raise osv.except_osv(_('No Cash Register Defined!'), _('You have to define which payment method must be available in the point of sale by reusing existing bank and cash through "Accounting / Configuration / Journals / Journals". Select a journal and check the field "PoS Payment Method" from the "Point of Sale" tab. You can also create new payment methods directly from menu "PoS Backend / Configuration / Payment Methods".'))
for journal in journal_obj.browse(cr, uid, j_ids, context=context): for journal in journal_obj.browse(cr, uid, j_ids, context=context):
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context) ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context)

View File

@ -223,7 +223,7 @@ class wizard_user(osv.osv_memory):
this_context = context this_context = context
this_user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context) this_user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context)
if not this_user.email: if not this_user.email:
raise osv.except_osv(_('Email required'), raise osv.except_osv(_('Email Required'),
_('You must have an email address in your User Preferences to send emails.')) _('You must have an email address in your User Preferences to send emails.'))
# determine subject and body in the portal user's language # determine subject and body in the portal user's language

View File

@ -37,7 +37,7 @@
<field name="model">hr.employee</field> <field name="model">hr.employee</field>
<field name="inherit_id" eval="False"/> <field name="inherit_id" eval="False"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<kanban> <kanban create="false">
<field name="last_login"/> <field name="last_login"/>
<templates> <templates>
<t t-name="kanban-box"> <t t-name="kanban-box">

View File

@ -307,7 +307,7 @@ class procurement_order(osv.osv):
move_obj = self.pool.get('stock.move') move_obj = self.pool.get('stock.move')
for procurement in self.browse(cr, uid, ids, context=context): for procurement in self.browse(cr, uid, ids, context=context):
if procurement.product_qty <= 0.00: if procurement.product_qty <= 0.00:
raise osv.except_osv(_('Data Insufficient !'), raise osv.except_osv(_('Data Insufficient!'),
_('Please check the quantity in procurement order(s) for the product "%s", it should not be 0 or less!' % procurement.product_id.name)) _('Please check the quantity in procurement order(s) for the product "%s", it should not be 0 or less!' % procurement.product_id.name))
if procurement.product_id.type in ('product', 'consu'): if procurement.product_id.type in ('product', 'consu'):
if not procurement.move_id: if not procurement.move_id:

View File

@ -256,7 +256,7 @@
<field name="search_view_id" ref="warehouse_orderpoint_search" /> <field name="search_view_id" ref="warehouse_orderpoint_search" />
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to add a reordering rules. Click to add a reordering rule.
</p><p>You can define your minimum stock rules, so that OpenERP will automatically create draft manufacturing orders or request for quotations according to the stock level. Once the virtual stock of a product (= stock on hand minus all confirmed orders and reservations) is below the minimum quantity, OpenERP will generate a procurement request to increase the stock up to the maximum quantity.</p> </p><p>You can define your minimum stock rules, so that OpenERP will automatically create draft manufacturing orders or request for quotations according to the stock level. Once the virtual stock of a product (= stock on hand minus all confirmed orders and reservations) is below the minimum quantity, OpenERP will generate a procurement request to increase the stock up to the maximum quantity.</p>
</field> </field>
</record> </record>

View File

@ -10,7 +10,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Procurement Request" version="7.0"> <form string="Procurement Request" version="7.0">
<p class="oe_gray"> <p class="oe_gray">
Fill is this for to launch a procurement request for this Use this assistant to generate a procurement request for this
product. According to the product configuration, this may product. According to the product configuration, this may
trigger a draft purchase order, a manufacturing order or trigger a draft purchase order, a manufacturing order or
a new task. a new task.

View File

@ -8,8 +8,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside"> <page string="Sales &amp; Purchases" position="inside">
<group> <group>
<group name="pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}"> <group name="pricelists" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
<field name="property_product_pricelist"/> <field name="property_product_pricelist" groups="product.group_sale_pricelist"/>
</group> </group>
<div name="parent_pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}"> <div name="parent_pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
<p>Pricelists are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p> <p>Pricelists are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>

View File

@ -60,6 +60,8 @@
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:param name="pmaxChars" as="xs:integer" select="80"/>
<xsl:template match="lot-line" mode="story"> <xsl:template match="lot-line" mode="story">
<blockTable style="mytable" colWidths="2.8cm,5.4cm"> <blockTable style="mytable" colWidths="2.8cm,5.4cm">
<tr> <tr>
@ -75,7 +77,7 @@
<barCode><xsl:value-of select="ean13" /></barCode> <barCode><xsl:value-of select="ean13" /></barCode>
</td> </td>
<td> <td>
<para style="nospace"><xsl:value-of select="product"/></para><xsl:text>, </xsl:text> <para style="nospace"><xsl:value-of select="substring(product, 1, pmaxChars)"/></para><xsl:text>, </xsl:text>
<para style="nospace"><xsl:value-of select="variant"/></para> <para style="nospace"><xsl:value-of select="variant"/></para>
</td> </td>
</tr> </tr>

View File

@ -98,10 +98,10 @@ class sale_order_line(osv.osv):
class account_invoice_line(osv.osv): class account_invoice_line(osv.osv):
_inherit = "account.invoice.line" _inherit = "account.invoice.line"
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None):
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit,currency_id, context=context, company_id=company_id) res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty, name, type, partner_id, fposition_id, price_unit,currency_id, context=context, company_id=company_id)
def get_real_price(res_dict, product_id, qty, uom, pricelist): def get_real_price(res_dict, product_id, qty, uom_id, pricelist):
item_obj = self.pool.get('product.pricelist.item') item_obj = self.pool.get('product.pricelist.item')
price_type_obj = self.pool.get('product.price.type') price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product') product_obj = self.pool.get('product.product')
@ -119,7 +119,7 @@ class account_invoice_line(osv.osv):
product_read = product_obj.read(cr, uid, product_id, [field_name], context=context) product_read = product_obj.read(cr, uid, product_id, [field_name], context=context)
factor = 1.0 factor = 1.0
if uom and uom != product.uom_id.id: if uom_id and uom_id != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom') product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id) uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor factor = uom_data.factor
@ -137,18 +137,18 @@ class account_invoice_line(osv.osv):
pricelist =partner_obj.browse(cr, uid, partner_id).property_product_pricelist_purchase.id pricelist =partner_obj.browse(cr, uid, partner_id).property_product_pricelist_purchase.id
if not pricelist: if not pricelist:
raise osv.except_osv(_('No Purchase Pricelist Found!'),_("You must first define a pricelist on the supplier form!")) raise osv.except_osv(_('No Purchase Pricelist Found!'),_("You must first define a pricelist on the supplier form!"))
price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom}) price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom_id})
price_unit = price_unit_res[pricelist] price_unit = price_unit_res[pricelist]
real_price = get_real_price(price_unit_res, product.id, qty, uom, pricelist) real_price = get_real_price(price_unit_res, product.id, qty, uom_id, pricelist)
else: else:
if partner_id: if partner_id:
pricelist = partner_obj.browse(cr, uid, partner_id).property_product_pricelist.id pricelist = partner_obj.browse(cr, uid, partner_id).property_product_pricelist.id
if not pricelist: if not pricelist:
raise osv.except_osv(_('No Sale Pricelist Found!'),_("You must first define a pricelist on the customer form!")) raise osv.except_osv(_('No Sale Pricelist Found!'),_("You must first define a pricelist on the customer form!"))
price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom}) price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom_id})
price_unit = price_unit_res[pricelist] price_unit = price_unit_res[pricelist]
real_price = get_real_price(price_unit_res, product.id, qty, uom, pricelist) real_price = get_real_price(price_unit_res, product.id, qty, uom_id, pricelist)
if pricelist: if pricelist:
pricelists=pricelist_obj.read(cr,uid,[pricelist],['visible_discount']) pricelists=pricelist_obj.read(cr,uid,[pricelist],['visible_discount'])
if(len(pricelists)>0 and pricelists[0]['visible_discount'] and real_price != 0): if(len(pricelists)>0 and pricelists[0]['visible_discount'] and real_price != 0):

View File

@ -450,7 +450,7 @@ class project(osv.osv):
for project in projects: for project in projects:
if (not project.members) and force_members: if (not project.members) and force_members:
raise osv.except_osv(_('Warning!'),_("You must assign members on the project '%s' !") % (project.name,)) raise osv.except_osv(_('Warning!'),_("You must assign members on the project '%s'!") % (project.name,))
resource_pool = self.pool.get('resource.resource') resource_pool = self.pool.get('resource.resource')
@ -956,7 +956,7 @@ class task(base_stage, osv.osv):
if task.child_ids: if task.child_ids:
for child in task.child_ids: for child in task.child_ids:
if child.state in ['draft', 'open', 'pending']: if child.state in ['draft', 'open', 'pending']:
raise osv.except_osv(_("Warning !"), _("Child task still open.\nPlease cancel or complete child task first.")) raise osv.except_osv(_("Warning!"), _("Child task still open.\nPlease cancel or complete child task first."))
return True return True
def action_close(self, cr, uid, ids, context=None): def action_close(self, cr, uid, ids, context=None):

View File

@ -29,6 +29,14 @@ class res_partner(osv.osv):
'task_ids': fields.one2many('project.task', 'partner_id', 'Tasks'), 'task_ids': fields.one2many('project.task', 'partner_id', 'Tasks'),
} }
def copy(self, cr, uid, record_id, default=None, context=None):
if default is None:
default = {}
default['task_ids'] = []
return super(res_partner, self).copy(
cr, uid, record_id, default=default, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -49,7 +49,7 @@ class project_timebox_empty(osv.osv_memory):
ids = obj_tb.search(cr, uid, [], context=context) ids = obj_tb.search(cr, uid, [], context=context)
if not len(ids): if not len(ids):
raise osv.except_osv(_('Error!'), _('No timebox child of this one !')) raise osv.except_osv(_('Error!'), _('No timebox child of this one!'))
tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])]) tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])])
for task in obj_task.browse(cr, uid, tids, context): for task in obj_task.browse(cr, uid, tids, context):
if (task.state in ('cancel','done')) or (task.user_id.id <> uid): if (task.state in ('cancel','done')) or (task.user_id.id <> uid):

View File

@ -79,22 +79,22 @@ class project_work(osv.osv):
emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)]) emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)])
if not emp_id: if not emp_id:
user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name'] user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name']
raise osv.except_osv(_('Bad Configuration !'), raise osv.except_osv(_('Bad Configuration!'),
_('Please define employee for user "%s". You must create one.')% (user_name,)) _('Please define employee for user "%s". You must create one.')% (user_name,))
emp = emp_obj.browse(cr, uid, emp_id[0]) emp = emp_obj.browse(cr, uid, emp_id[0])
if not emp.product_id: if not emp.product_id:
raise osv.except_osv(_('Bad Configuration !'), raise osv.except_osv(_('Bad Configuration!'),
_('Please define product and product category property account on the related employee.\nFill in the HR Settings tab of the employee form.')) _('Please define product and product category property account on the related employee.\nFill in the HR Settings tab of the employee form.'))
if not emp.journal_id: if not emp.journal_id:
raise osv.except_osv(_('Bad Configuration !'), raise osv.except_osv(_('Bad Configuration!'),
_('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.')) _('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.'))
acc_id = emp.product_id.property_account_expense.id acc_id = emp.product_id.property_account_expense.id
if not acc_id: if not acc_id:
acc_id = emp.product_id.categ_id.property_account_expense_categ.id acc_id = emp.product_id.categ_id.property_account_expense_categ.id
if not acc_id: if not acc_id:
raise osv.except_osv(_('Bad Configuration !'), raise osv.except_osv(_('Bad Configuration!'),
_('Please define product and product category property account on the related employee.\nFill in the timesheet tab of the employee form.')) _('Please define product and product category property account on the related employee.\nFill in the timesheet tab of the employee form.'))
res['product_id'] = emp.product_id.id res['product_id'] = emp.product_id.id
@ -286,7 +286,7 @@ class account_analytic_line(osv.osv):
st = acc.to_invoice.id st = acc.to_invoice.id
res['value']['to_invoice'] = st or False res['value']['to_invoice'] = st or False
if acc.state == 'close' or acc.state == 'cancelled': if acc.state == 'close' or acc.state == 'cancelled':
raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state.')) raise osv.except_osv(_('Invalid Analytic Account!'), _('You cannot select a Analytic Account which is in Close or Cancelled state.'))
return res return res

View File

@ -8,7 +8,7 @@
<field name="priority">36</field> <field name="priority">36</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="property_product_pricelist" position="after"> <field name="property_product_pricelist" position="after">
<field name="property_product_pricelist_purchase" /> <field name="property_product_pricelist_purchase" groups="product.group_purchase_pricelist"/>
</field> </field>
</field> </field>
</record> </record>

View File

@ -65,7 +65,9 @@
<field name="context">{"default_type": "in", "contact_display": "partner_address", "search_default_done": 1, "search_default_to_invoice": 1}</field> <field name="context">{"default_type": "in", "contact_display": "partner_address", "search_default_done": 1, "search_default_to_invoice": 1}</field>
<field name="search_view_id" ref="stock.view_picking_in_search"/> <field name="search_view_id" ref="stock.view_picking_in_search"/>
<field name="help" type="html"> <field name="help" type="html">
<p> <p class="oe_view_nocontent_create">
Click to create a new incoming shipment.
</p><p>
Here you can track all the product receptions of purchase Here you can track all the product receptions of purchase
orders where the invoicing is "Based on Incoming Shipments", orders where the invoicing is "Based on Incoming Shipments",
and for which you have not received a supplier invoice yet. and for which you have not received a supplier invoice yet.

View File

@ -242,8 +242,13 @@ class WebKitParser(report_sxw):
def translate_call(self, src): def translate_call(self, src):
"""Translate String.""" """Translate String."""
ir_translation = self.pool['ir.translation'] ir_translation = self.pool['ir.translation']
name = self.tmpl and 'addons/' + self.tmpl or None
res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid, res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src) name, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
if res == src:
# no translation defined, fallback on None (backward compatibility)
res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
if not res : if not res :
return src return src
return res return res

View File

@ -90,7 +90,11 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/> <field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_resource_calendar_search"/> <field name="search_view_id" ref="view_resource_calendar_search"/>
<field name="help">Define working hours and time table that could be scheduled to your project members</field> <field name="help" type="html">
<p class="oe_view_nocontent_create">
Define working hours and time table that could be scheduled to your project members
</p>
</field>
</record> </record>
<record id="view_resource_calendar_attendance_tree" model="ir.ui.view"> <record id="view_resource_calendar_attendance_tree" model="ir.ui.view">

View File

@ -273,7 +273,7 @@ class sale_order(osv.osv):
if s['state'] in ['draft', 'cancel']: if s['state'] in ['draft', 'cancel']:
unlink_ids.append(s['id']) unlink_ids.append(s['id'])
else: else:
raise osv.except_osv(_('Invalid Action!'), _('In order to delete a confirmed sales order, you must cancel it before !')) raise osv.except_osv(_('Invalid Action!'), _('In order to delete a confirmed sales order, you must cancel it before!'))
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
@ -870,7 +870,7 @@ class sale_order_line(osv.osv):
context = context or {} context = context or {}
lang = lang or context.get('lang',False) lang = lang or context.get('lang',False)
if not partner_id: if not partner_id:
raise osv.except_osv(_('No Customer Defined !'), _('Before choosing a product,\n select a customer in the sales form.')) raise osv.except_osv(_('No Customer Defined!'), _('Before choosing a product,\n select a customer in the sales form.'))
warning = {} warning = {}
product_uom_obj = self.pool.get('product.uom') product_uom_obj = self.pool.get('product.uom')
partner_obj = self.pool.get('res.partner') partner_obj = self.pool.get('res.partner')

View File

@ -78,16 +78,18 @@ class crm_make_sale(osv.osv_memory):
['default', 'invoice', 'delivery', 'contact']) ['default', 'invoice', 'delivery', 'contact'])
pricelist = partner.property_product_pricelist.id pricelist = partner.property_product_pricelist.id
fpos = partner.property_account_position and partner.property_account_position.id or False fpos = partner.property_account_position and partner.property_account_position.id or False
payment_term = partner.property_payment_term and partner.property_payment_term.id or False
new_ids = [] new_ids = []
for case in case_obj.browse(cr, uid, data, context=context): for case in case_obj.browse(cr, uid, data, context=context):
if not partner and case.partner_id: if not partner and case.partner_id:
partner = case.partner_id partner = case.partner_id
fpos = partner.property_account_position and partner.property_account_position.id or False fpos = partner.property_account_position and partner.property_account_position.id or False
payment_term = partner.property_payment_term and partner.property_payment_term.id or False
partner_addr = partner_obj.address_get(cr, uid, [partner.id], partner_addr = partner_obj.address_get(cr, uid, [partner.id],
['default', 'invoice', 'delivery', 'contact']) ['default', 'invoice', 'delivery', 'contact'])
pricelist = partner.property_product_pricelist.id pricelist = partner.property_product_pricelist.id
if False in partner_addr.values(): if False in partner_addr.values():
raise osv.except_osv(_('Insufficient Data!'), _('No addresse(s) defined for this customer.')) raise osv.except_osv(_('Insufficient Data!'), _('No address(es) defined for this customer.'))
vals = { vals = {
'origin': _('Opportunity: %s') % str(case.id), 'origin': _('Opportunity: %s') % str(case.id),
@ -100,6 +102,7 @@ class crm_make_sale(osv.osv_memory):
'partner_shipping_id': partner_addr['delivery'], 'partner_shipping_id': partner_addr['delivery'],
'date_order': fields.date.context_today(self,cr,uid,context=context), 'date_order': fields.date.context_today(self,cr,uid,context=context),
'fiscal_position': fpos, 'fiscal_position': fpos,
'payment_term':payment_term,
} }
if partner.id: if partner.id:
vals['user_id'] = partner.user_id and partner.user_id.id or uid vals['user_id'] = partner.user_id and partner.user_id.id or uid

View File

@ -587,9 +587,6 @@ class sale_order_line(osv.osv):
return res return res
#update of result obtained in super function #update of result obtained in super function
res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
res['value'].update(res_packing.get('value', {}))
warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or ''
product_obj = product_obj.browse(cr, uid, product, context=context) product_obj = product_obj.browse(cr, uid, product, context=context)
res['value']['delay'] = (product_obj.sale_delay or 0.0) res['value']['delay'] = (product_obj.sale_delay or 0.0)
res['value']['type'] = product_obj.procure_method res['value']['type'] = product_obj.procure_method
@ -602,6 +599,11 @@ class sale_order_line(osv.osv):
uom = False uom = False
if not uom2: if not uom2:
uom2 = product_obj.uom_id uom2 = product_obj.uom_id
# Calling product_packaging_change function after updating UoM
res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
res['value'].update(res_packing.get('value', {}))
warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or ''
compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding) compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
if (product_obj.type=='product') and int(compare_qty) == -1 \ if (product_obj.type=='product') and int(compare_qty) == -1 \
and (product_obj.procure_method=='make_to_stock'): and (product_obj.procure_method=='make_to_stock'):

View File

@ -14,7 +14,7 @@ openerp.share = function(session) {
else rec_name = ''; else rec_name = '';
session.web.pyeval.eval_domains_and_contexts({ session.web.pyeval.eval_domains_and_contexts({
domains: [domain], domains: [domain],
contexts: [view.dataset.context] contexts: [Share.get_context()]
}).done(function (result) { }).done(function (result) {
Share.create({ Share.create({
name: action.name, name: action.name,
@ -25,7 +25,7 @@ openerp.share = function(session) {
view_type: view.fields_view.type, view_type: view.fields_view.type,
invite: invite || false, invite: invite || false,
}).done(function(share_id) { }).done(function(share_id) {
var step1 = Share.call('go_step_1', [[share_id]]).done(function(result) { var step1 = Share.call('go_step_1', [[share_id], Share.get_context()]).done(function(result) {
var action = result; var action = result;
self.do_action(action); self.do_action(action);
}); });

View File

@ -832,7 +832,7 @@ class share_wizard(osv.TransientModel):
notification_obj = self.pool.get('mail.notification') notification_obj = self.pool.get('mail.notification')
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid) user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
if not user.email: if not user.email:
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) raise osv.except_osv(_('Email Required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
# TODO: also send an HTML version of this mail # TODO: also send an HTML version of this mail
for result_line in wizard_data.result_line_ids: for result_line in wizard_data.result_line_ids:
@ -863,7 +863,7 @@ class share_wizard(osv.TransientModel):
mail_mail = self.pool.get('mail.mail') mail_mail = self.pool.get('mail.mail')
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid) user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
if not user.email: if not user.email:
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) raise osv.except_osv(_('Email Required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
# TODO: also send an HTML version of this mail # TODO: also send an HTML version of this mail
mail_ids = [] mail_ids = []

View File

@ -258,7 +258,9 @@
<para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para> <para style="terp_default_Centre_9">[[ (move_lines.prodlot_id and move_lines.prodlot_id.name) or '' ]]</para>
</td> </td>
<td> <td>
<para style="terp_default_9">[[ move_lines.state ]]</para> <para style="terp_default_9">Waiting Availability[[ move_lines.state == 'confirmed' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_9">Done[[ move_lines.state == 'done' and ' ' or removeParentNode('para') ]]</para>
<para style="terp_default_9">Available[[ move_lines.state == 'assigned' and ' ' or removeParentNode('para') ]]</para>
</td> </td>
<td> <td>
<para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]] </para> <para style="terp_default_Right_9">[[ (move_lines.location_id and move_lines.location_id.name) or '' ]] </para>

View File

@ -1110,7 +1110,7 @@ class stock_picking(osv.osv):
if isinstance(partner, int): if isinstance(partner, int):
partner = partner_obj.browse(cr, uid, [partner], context=context)[0] partner = partner_obj.browse(cr, uid, [partner], context=context)[0]
if not partner: if not partner:
raise osv.except_osv(_('Error, no partner !'), raise osv.except_osv(_('Error, no partner!'),
_('Please put a partner on the picking list if you want to generate invoice.')) _('Please put a partner on the picking list if you want to generate invoice.'))
if not inv_type: if not inv_type:
@ -1637,7 +1637,7 @@ class stock_move(osv.osv):
"* Waiting Availability: This state is reached when the procurement resolution is not straight forward. It may need the scheduler to run, a component to me manufactured...\n"\ "* Waiting Availability: This state is reached when the procurement resolution is not straight forward. It may need the scheduler to run, a component to me manufactured...\n"\
"* Available: When products are reserved, it is set to \'Available\'.\n"\ "* Available: When products are reserved, it is set to \'Available\'.\n"\
"* Done: When the shipment is processed, the state is \'Done\'."), "* Done: When the shipment is processed, the state is \'Done\'."),
'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Account'), help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"), 'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Product Price'), help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),
'price_currency_id': fields.many2one('res.currency', 'Currency for average price', help="Technical field used to record the currency chosen by the user during a picking confirmation (when average price costing method is used)"), 'price_currency_id': fields.many2one('res.currency', 'Currency for average price', help="Technical field used to record the currency chosen by the user during a picking confirmation (when average price costing method is used)"),
'company_id': fields.many2one('res.company', 'Company', required=True, select=True), 'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order of", select=True), 'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order of", select=True),
@ -1764,7 +1764,7 @@ class stock_move(osv.osv):
for move in self.browse(cr, uid, ids, context=context): for move in self.browse(cr, uid, ids, context=context):
if move.state == 'done': if move.state == 'done':
if frozen_fields.intersection(vals): if frozen_fields.intersection(vals):
raise osv.except_osv(_('Operation forbidden !'), raise osv.except_osv(_('Operation Forbidden!'),
_('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator).')) _('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator).'))
return super(stock_move, self).write(cr, uid, ids, vals, context=context) return super(stock_move, self).write(cr, uid, ids, vals, context=context)
@ -2192,7 +2192,7 @@ class stock_move(osv.osv):
if move.picking_id: if move.picking_id:
pickings.add(move.picking_id.id) pickings.add(move.picking_id.id)
if move.move_dest_id and move.move_dest_id.state == 'waiting': if move.move_dest_id and move.move_dest_id.state == 'waiting':
self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
if context.get('call_unlink',False) and move.move_dest_id.picking_id: if context.get('call_unlink',False) and move.move_dest_id.picking_id:
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}) self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
@ -2412,8 +2412,8 @@ class stock_move(osv.osv):
# or if it's the same as that of the secondary amount being posted. # or if it's the same as that of the secondary amount being posted.
account_obj = self.pool.get('account.account') account_obj = self.pool.get('account.account')
src_acct, dest_acct = account_obj.browse(cr, uid, [src_account_id, dest_account_id], context=context) src_acct, dest_acct = account_obj.browse(cr, uid, [src_account_id, dest_account_id], context=context)
src_main_currency_id = src_acct.currency_id and src_acct.currency_id.id or src_acct.company_id.currency_id.id src_main_currency_id = src_acct.company_id.currency_id.id
dest_main_currency_id = dest_acct.currency_id and dest_acct.currency_id.id or dest_acct.company_id.currency_id.id dest_main_currency_id = dest_acct.company_id.currency_id.id
cur_obj = self.pool.get('res.currency') cur_obj = self.pool.get('res.currency')
if reference_currency_id != src_main_currency_id: if reference_currency_id != src_main_currency_id:
# fix credit line: # fix credit line:

View File

@ -22,6 +22,7 @@
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
import time import time
from openerp.tools.translate import _
class stock_partial_move_line(osv.osv_memory): class stock_partial_move_line(osv.osv_memory):
_inherit = "stock.partial.picking.line" _inherit = "stock.partial.picking.line"
@ -67,6 +68,8 @@ class stock_partial_move(osv.osv_memory):
} }
moves_ids = [] moves_ids = []
for move in partial.move_ids: for move in partial.move_ids:
if not move.move_id:
raise osv.except_osv(_('Warning !'), _("You have manually created product lines, please delete them to proceed"))
move_id = move.move_id.id move_id = move.move_id.id
partial_data['move%s' % (move_id)] = { partial_data['move%s' % (move_id)] = {
'product_id': move.product_id.id, 'product_id': move.product_id.id,

View File

@ -178,7 +178,7 @@ class stock_partial_picking(osv.osv_memory):
if line_uom.factor and line_uom.factor <> 0: if line_uom.factor and line_uom.factor <> 0:
if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0: if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name)) raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only rounding of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
if move_id: if move_id:
#Check rounding Quantity.ex. #Check rounding Quantity.ex.
#picking: 1kg, uom kg rounding = 0.01 (rounding to 10g), #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g),
@ -189,7 +189,7 @@ class stock_partial_picking(osv.osv_memory):
qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id) qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0: if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name)) raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only rounding of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
else: else:
seq_obj_name = 'stock.picking.' + picking_type seq_obj_name = 'stock.picking.' + picking_type
move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name), move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name),

View File

@ -180,6 +180,8 @@ class stock_return_picking(osv.osv_memory):
for v in val_id: for v in val_id:
data_get = data_obj.browse(cr, uid, v, context=context) data_get = data_obj.browse(cr, uid, v, context=context)
mov_id = data_get.move_id.id mov_id = data_get.move_id.id
if not mov_id:
raise osv.except_osv(_('Warning !'), _("You have manually created product lines, please delete them to proceed"))
new_qty = data_get.quantity new_qty = data_get.quantity
move = move_obj.browse(cr, uid, mov_id, context=context) move = move_obj.browse(cr, uid, mov_id, context=context)
new_location = move.location_dest_id.id new_location = move.location_dest_id.id

View File

@ -115,7 +115,7 @@ class subscription_subscription(osv.osv):
id = int(id) id = int(id)
model = self.pool[model_name] model = self.pool[model_name]
except: except:
raise osv.except_osv(_('Wrong Source Document !'), _('Please provide another source document.\nThis one does not exist !')) raise osv.except_osv(_('Wrong Source Document!'), _('Please provide another source document.\nThis one does not exist!'))
default = {'state':'draft'} default = {'state':'draft'}
doc_obj = self.pool.get('subscription.document') doc_obj = self.pool.get('subscription.document')
@ -142,7 +142,7 @@ class subscription_subscription(osv.osv):
def unlink(self, cr, uid, ids, context=None): def unlink(self, cr, uid, ids, context=None):
for record in self.browse(cr, uid, ids, context or {}): for record in self.browse(cr, uid, ids, context or {}):
if record.state=="running": if record.state=="running":
raise osv.except_osv(_('Error!'),_('You cannot delete an active subscription !')) raise osv.except_osv(_('Error!'),_('You cannot delete an active subscription!'))
return super(subscription_subscription, self).unlink(cr, uid, ids, context) return super(subscription_subscription, self).unlink(cr, uid, ids, context)
def set_done(self, cr, uid, ids, context=None): def set_done(self, cr, uid, ids, context=None):

View File

@ -498,7 +498,7 @@ class survey_question(osv.osv):
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
minimum_ans = 0 minimum_ans = 0
maximum_ans = 0 maximum_ans = 0
page = self.pool.get('survey.page').browse(cr, uid, vals['page_id'], context=context).title page = self.pool.get('survey.page').browse(cr, uid, int(vals.get('page_id', 0)), context=context).title
if vals.has_key('answer_choice_ids') and not len(vals['answer_choice_ids']): if vals.has_key('answer_choice_ids') and not len(vals['answer_choice_ids']):
if vals.has_key('type') and vals['type'] not in ['descriptive_text', 'single_textbox', 'comment','table']: if vals.has_key('type') and vals['type'] not in ['descriptive_text', 'single_textbox', 'comment','table']:
raise osv.except_osv(_('Warning!'),_('You must enter one or more answers for question "%s" of page %s .') % (vals['question'], page)) raise osv.except_osv(_('Warning!'),_('You must enter one or more answers for question "%s" of page %s .') % (vals['question'], page))

View File

@ -772,6 +772,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Survey Question"> <form string="Survey Question">
<field name="question" colspan="4"/> <field name="question" colspan="4"/>
<field name="page_id"/>
<field name="sequence"/> <field name="sequence"/>
<field name="tot_resp"/> <field name="tot_resp"/>
<field name="type" on_change="on_change_type(type)"/> <field name="type" on_change="on_change_type(type)"/>

View File

@ -1038,6 +1038,7 @@ class survey_question_wiz(osv.osv_memory):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'target': 'new', 'target': 'new',
'view_id': view_id, 'view_id': view_id,
'page_id': int(context.get('page_id',0)),
'context': context 'context': context
} }

View File

@ -63,7 +63,7 @@ class sale_order(osv.osv):
partner = self.pool.get('res.partner').browse(cr, uid, part, context=context) partner = self.pool.get('res.partner').browse(cr, uid, part, context=context)
if partner.sale_warn != 'no-message': if partner.sale_warn != 'no-message':
if partner.sale_warn == 'block': if partner.sale_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.sale_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.sale_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.sale_warn_msg message = partner.sale_warn_msg
warning = { warning = {
@ -91,7 +91,7 @@ class purchase_order(osv.osv):
partner = self.pool.get('res.partner').browse(cr, uid, part) partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.purchase_warn != 'no-message': if partner.purchase_warn != 'no-message':
if partner.purchase_warn == 'block': if partner.purchase_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.purchase_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.purchase_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.purchase_warn_msg message = partner.purchase_warn_msg
warning = { warning = {
@ -124,7 +124,7 @@ class account_invoice(osv.osv):
partner = self.pool.get('res.partner').browse(cr, uid, partner_id) partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
if partner.invoice_warn != 'no-message': if partner.invoice_warn != 'no-message':
if partner.invoice_warn == 'block': if partner.invoice_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.invoice_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.invoice_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.invoice_warn_msg message = partner.invoice_warn_msg
@ -155,7 +155,7 @@ class stock_picking(osv.osv):
message = False message = False
if partner.picking_warn != 'no-message': if partner.picking_warn != 'no-message':
if partner.picking_warn == 'block': if partner.picking_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg message = partner.picking_warn_msg
warning = { warning = {
@ -184,7 +184,7 @@ class stock_picking_in(osv.osv):
message = False message = False
if partner.picking_warn != 'no-message': if partner.picking_warn != 'no-message':
if partner.picking_warn == 'block': if partner.picking_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg message = partner.picking_warn_msg
warning = { warning = {
@ -210,7 +210,7 @@ class stock_picking_out(osv.osv):
message = False message = False
if partner.picking_warn != 'no-message': if partner.picking_warn != 'no-message':
if partner.picking_warn == 'block': if partner.picking_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
title = _("Warning for %s") % partner.name title = _("Warning for %s") % partner.name
message = partner.picking_warn_msg message = partner.picking_warn_msg
warning = { warning = {
@ -257,7 +257,7 @@ class sale_order_line(osv.osv):
if product_info.sale_line_warn != 'no-message': if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block': if product_info.sale_line_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.sale_line_warn_msg) raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.sale_line_warn_msg)
title = _("Warning for %s") % product_info.name title = _("Warning for %s") % product_info.name
message = product_info.sale_line_warn_msg message = product_info.sale_line_warn_msg
warning['title'] = title warning['title'] = title
@ -289,7 +289,7 @@ class purchase_order_line(osv.osv):
if product_info.purchase_line_warn != 'no-message': if product_info.purchase_line_warn != 'no-message':
if product_info.purchase_line_warn == 'block': if product_info.purchase_line_warn == 'block':
raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.purchase_line_warn_msg) raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.purchase_line_warn_msg)
title = _("Warning for %s") % product_info.name title = _("Warning for %s") % product_info.name
message = product_info.purchase_line_warn_msg message = product_info.purchase_line_warn_msg
warning['title'] = title warning['title'] = title

View File

@ -41,7 +41,7 @@
<record id="product_warning_form_view" model="ir.ui.view"> <record id="product_warning_form_view" model="ir.ui.view">
<field name="name">product.warning.form.inherit</field> <field name="name">product.warning.form.inherit</field>
<field name="model">product.product</field> <field name="model">product.product</field>
<field name="inherit_id" ref="procurement.product_template_form_view_procurement"/> <field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<notebook position="inside"> <notebook position="inside">
<page string="Warnings"> <page string="Warnings">