[MERGE] Sync with trunk.

bzr revid: tde@openerp.com-20121113155209-0ch1a682bzmzv3x1
This commit is contained in:
Thibault Delavallée 2012-11-13 16:52:09 +01:00
commit 292666ecc3
42 changed files with 327 additions and 204 deletions

View File

@ -107,7 +107,7 @@ class account_analytic_line(osv.osv):
if journal_id:
journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
if journal.type == 'sale':
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context=context)
if product_price_type_ids:
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
# Take the company currency as the reference one

View File

@ -486,6 +486,19 @@ class account_bank_statement(osv.osv):
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
def button_journal_entries(self, cr, uid, ids, context=None):
ctx = (context or {}).copy()
ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id
return {
'view_type':'form',
'view_mode':'tree',
'res_model':'account.move.line',
'view_id':False,
'type':'ir.actions.act_window',
'domain':[('statement_id','in',ids)],
'context':ctx,
}
account_bank_statement()
class account_bank_statement_line(osv.osv):

View File

@ -402,6 +402,7 @@ class account_invoice(osv.osv):
'default_res_id': ids[0],
'default_use_template': True,
'default_template_id': template_id,
'default_composition_mode': 'comment',
})
return {
'view_type': 'form',

View File

@ -582,7 +582,7 @@ class account_move_line(osv.osv):
lines = self.browse(cr, uid, ids, context=context)
for l in lines:
if l.account_id.type == 'view':
raise osv.except_osv(_('Error!'), _('You cannot create journal items on “View” type account %s %s.') % (l.account_id.code, l.account_id.name))
return False
return True
def _check_no_closed(self, cr, uid, ids, context=None):

View File

@ -302,7 +302,7 @@
<field name="domain">[('parent_id','=',False)]</field>
</record>
<record id="view_account_gain_loss_tree" model="ir.ui.view">
<record id="view_account_gain_loss_tree" model="ir.ui.view">
<field name="name">Unrealized Gain or Loss</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
@ -322,7 +322,7 @@
</field>
</record>
<record id="action_account_gain_loss" model="ir.actions.act_window">
<record id="action_account_gain_loss" model="ir.actions.act_window">
<field name="name">Unrealized Gain or Loss</field>
<field name="res_model">account.account</field>
<field name="view_type">form</field>
@ -650,7 +650,7 @@
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_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="amount"/>
</tree>
@ -661,7 +661,7 @@
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="account_id" domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('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="amount"/>
<field name="sequence" readonly="0"/>
@ -671,15 +671,24 @@
</form>
</field>
</page>
<page string="Journal Entries" name="move_live_ids">
<field name="move_line_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_bank_statement_form_journal_items" model="ir.ui.view">
<field name="name">account.bank.statement.journal.items.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='import_buttons']" position="inside">
<button name="button_journal_entries"
string="Journal Items" type="object"
attrs="{'invisible':[('state','!=','confirm')]}"/>
</xpath>
</field>
</record>
<record id="action_bank_statement_tree" model="ir.actions.act_window">
<field name="name">Bank Statements</field>
@ -1055,7 +1064,7 @@
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
<field eval="4" name="priority"/>
@ -1850,7 +1859,7 @@
</field>
</record>
<record id="view_subscription_search" model="ir.ui.view">
<record id="view_subscription_search" model="ir.ui.view">
<field name="name">account.subscription.search</field>
<field name="model">account.subscription</field>
<field name="arch" type="xml">

View File

@ -40,7 +40,7 @@
<field name="name">Automated Invoice Notification Mail</field>
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
<field name="email_to">${object.partner_id.email or ''}</field>
<field name="email_recipients">${object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[

View File

@ -276,7 +276,7 @@
</field>
</field>
</record>
<record model="ir.ui.view" id="view_default_inherit_tree">
<record model="ir.ui.view" id="view_default_inherit_tree">
<field name="name">account.analytic.default.tree.plans</field>
<field name="model">account.analytic.default</field>
<field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_tree"/>

View File

@ -386,7 +386,7 @@ class account_asset_depreciation_line(osv.osv):
current_currency = line.asset_id.currency_id.id
context.update({'date': depreciation_date})
amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.amount, context=context)
sign = line.asset_id.category_id.journal_id.type = 'purchase' and 1 or -1
sign = (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1
asset_name = line.asset_id.name
reference = line.name
move_vals = {

View File

@ -220,7 +220,18 @@
<menuitem parent="next_id_31"
id="menu_act_crossovered_budget_view"
action="act_crossovered_budget_view" sequence="1" />
<record id="view_crossovered_budget_line_search" model="ir.ui.view">
<field name="name">account.budget.line.search</field>
<field name="model">crossovered.budget.lines</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Budget Lines">
<field name="analytic_account_id"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_crossovered_budget_line_tree">
<field name="name">crossovered.budget.line.tree</field>
<field name="model">crossovered.budget.lines</field>

View File

@ -267,6 +267,7 @@ class account_voucher(osv.osv):
_order = "date desc, id desc"
# _rec_name = 'number'
_columns = {
'active': fields.boolean('Active', help="By default, reconciliation vouchers made on draft bank statements are set as inactive, which allow to hide the customer/supplier payment while the bank statement isn't confirmed."),
'type':fields.selection([
('sale','Sale'),
('purchase','Purchase'),
@ -328,6 +329,7 @@ class account_voucher(osv.osv):
'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'),
}
_defaults = {
'active': True,
'period_id': _get_period,
'partner_id': _get_partner,
'journal_id':_get_journal,
@ -1507,6 +1509,15 @@ account_voucher_line()
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
def button_confirm_bank(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
voucher_ids = []
for statement in self.browse(cr, uid, ids, context=context):
voucher_ids += [line.voucher_id.id for line in statement.line_ids if line.voucher_id]
if voucher_ids:
voucher_obj.write(cr, uid, voucher_ids, {'active': True}, context=context)
return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
def button_cancel(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
for st in self.browse(cr, uid, ids, context=context):
@ -1542,6 +1553,16 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
if 'value' not in res:
res['value'] = {}
res['value'].update({'voucher_id' : False})
return res
def onchange_amount(self, cr, uid, ids, amount, context=None):
return {'value' : {'voucher_id' : False}}
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
@ -1568,7 +1589,7 @@ class account_bank_statement_line(osv.osv):
_columns = {
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),
'voucher_id': fields.many2one('account.voucher', 'Reconciliation'),
}
def unlink(self, cr, uid, ids, context=None):

View File

@ -200,33 +200,29 @@
<field name="arch" type="xml">
<xpath expr="//div[@name='import_buttons']" position="inside">
<button name="%(action_view_account_statement_from_invoice_lines)d"
string="Import Invoices" type="action" icon="gtk-execute"
string="Import Invoices" type="action"
attrs="{'invisible':[('state','=','confirm')]}"/>
</xpath>
</field>
</record>
<record id="view_bank_statement_tree_voucher" model="ir.ui.view">
<record id="view_bank_statement_form_voucher" model="ir.ui.view">
<field name="name">account.bank.statement.voucher.tree.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
<field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
<field name="voucher_id" widget="many2onebutton" options="{'label':{'create':'Reconcile','edit':'Edit Reconciliation'}}" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'default_active': False}"/>
</xpath>
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before">
<field name="voucher_id" widget="many2onebutton" options="{'label':{'create':'Reconcile','edit':'Edit Reconciliation'}}" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'default_active': False}"/>
</xpath>
<field name="amount" position="attributes">
<attribute name="on_change">onchange_amount(amount)</attribute>
</field>
</field>
</record>
<record id="view_bank_statement_form_voucher" model="ir.ui.view">
<field name="name">account.bank.statement.voucher.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before">
<field name="voucher_id" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
</xpath>
</field>
</record>
<record id="view_cash_statement_tree_voucher" model="ir.ui.view">
<field name="name">account.cash.statement.voucher.tree.inherit</field>
<field name="model">account.bank.statement</field>

View File

@ -392,35 +392,33 @@
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<form string="Receipt" version="7.0">
<header>
<button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)" class="oe_highlight"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma" invisible="context.get('line_type', False)"/>
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
<header invisible="context.get('line_type', False)">
<button name="proforma_voucher" string="Validate" states="draft" class="oe_highlight"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma"/>
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" confirm="Are you sure to unreconcile and cancel this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft"/>
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
</header>
<sheet>
<h1 attrs="{'invisible': [('number','=',False)]}"><field name="number"/></h1>
<group>
<group invisible="context.get('line_type', False)">
<group>
<field name="partner_id" domain="[('customer','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
<field name="partner_id" domain="[('customer','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
<field name="currency_id" invisible="1"/>
<field name="amount" class="oe_inline"
string="Paid Amount"
widget="monetary" options="{'currency_field': 'currency_id'}"
invisible="context.get('line_type', False)"
on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
invisible="context.get('line_type', False)"
widget="selection"
on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
string="Payment Method"/>
</group>
<group>
<field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
<field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
<field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
<field name="date" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
<field name="reference" string="Payment Ref" placeholder="e.g. 003/10"/>
<field name="name" colspan="2" placeholder="e.g. Invoice SAJ/0042"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="account_id"
@ -432,7 +430,7 @@
</group>
<notebook>
<page string="Payment Information" groups="base.group_user">
<label for="line_cr_ids"/>
<label for="line_cr_ids" invisible="context.get('line_type', False)"/>
<field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -513,7 +511,7 @@
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<div class="oe_chatter" invisible="context.get('line_type', False)">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>

View File

@ -99,6 +99,8 @@ class res_partner_bank(osv.osv):
@param iban: IBAN as string
@return: True if IBAN is valid, False otherwise
"""
if not iban:
return False
iban = _format_iban(iban).lower()
if iban[:2] in _ref_iban and len(iban) != len(_format_iban(_ref_iban[iban[:2]])):
return False
@ -128,9 +130,9 @@ class res_partner_bank(osv.osv):
def _construct_constraint_msg(self, cr, uid, ids, context=None):
def default_iban_check(iban_cn):
return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase
return iban_cn and iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase
iban_country = self.browse(cr, uid, ids)[0].acc_number[:2].lower()
iban_country = self.browse(cr, uid, ids)[0].acc_number and self.browse(cr, uid, ids)[0].acc_number[:2].lower()
if default_iban_check(iban_country):
if iban_country in _ref_iban:
return _('The IBAN does not seem to be correct. You should have entered something like this %s'), \

View File

@ -115,7 +115,6 @@ class crm_case_section(osv.osv):
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'change_responsible': fields.boolean('Reassign Escalated', help="When escalating to this team override the salesman with the team leader."),
'user_id': fields.many2one('res.users', 'Team Leader'),
'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'),
@ -137,7 +136,6 @@ class crm_case_section(osv.osv):
_defaults = {
'active': 1,
'allow_unlink': 1,
'stage_ids': _get_stage_common,
'alias_domain': False, # always hide alias during creation
}

View File

@ -79,7 +79,7 @@ class base_action_rule(osv.osv):
write['section_id'] = action.act_section_id.id
if hasattr(action, 'act_categ_id') and action.act_categ_id:
write['categ_ids'] = [4, action.act_categ_id.id]
write['categ_ids'] = [(4, action.act_categ_id.id)]
model_obj.write(cr, uid, [obj.id], write, context)
return res

View File

@ -779,14 +779,6 @@ class crm_lead(base_stage, format_address, osv.osv):
}
return res
def unlink(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context):
if (not lead.section_id.allow_unlink) and (lead.state != 'draft'):
raise osv.except_osv(_('Error!'),
_("You cannot delete lead '%s' because it is not in 'Draft' state. " \
"You can still cancel it, instead of deleting it.") % lead.name)
return super(crm_lead, self).unlink(cr, uid, ids, context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('stage_id') and not vals.get('probability'):
# change probability of lead(s) if required by stage

View File

@ -24,7 +24,7 @@
parent="base.menu_base_config" sequence="45" groups="base.group_sale_salesman"/>
<menuitem id="base.next_id_64" name="Sales"
parent="base.menu_reporting" sequence="1" />
parent="base.menu_reporting" sequence="1"/>
<menuitem id="base.menu_sales_configuration_misc" name="Miscellaneous" parent="base.menu_base_config" sequence="81"/>
@ -86,7 +86,7 @@
<field name="parent_id"/>
<field name="code"/>
</group>
<group>
<field name="user_id"/>
<field name="resource_calendar_id"/>
@ -102,7 +102,6 @@
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
<field name="change_responsible"/>
<field name="allow_unlink"/>
</group>
<separator string="Team Members"/>
<field name="member_ids" widget="many2many_kanban">
@ -163,7 +162,7 @@
<field name="view_id" ref="crm_case_section_view_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new sales team.
Click to define a new sales team.
</p><p>
Use sales team to organize your different salespersons or
departments into separate teams. Each team will work in
@ -203,7 +202,7 @@
<form string="Stage" version="7.0">
<group col="4">
<field name="name"/>
<field name="state" />
<field name="state"/>
<field name="probability"/>
<field name="type"/>
<field name="on_change"/>
@ -228,7 +227,7 @@
</record>
<!-- Case Categories Form View -->
<!-- Case Categories Form View -->
<record id="crm_case_categ-view" model="ir.ui.view">
<field name="name">crm.case.categ.form</field>
@ -238,7 +237,7 @@
<group>
<field name="name"/>
<field name="section_id"/>
<field name="object_id" invisible="1" />
<field name="object_id" invisible="1"/>
</group>
</form>
</field>
@ -297,7 +296,7 @@
<menuitem action="crm_case_resource_type_act"
id="menu_crm_case_resource_type_act" sequence="4"
groups="base.group_no_one"
parent="base.menu_crm_config_lead" />
parent="base.menu_crm_config_lead"/>
<record id="crm_case_section_act_tree" model="ir.actions.act_window">
<field name="name">Cases by Sales Team</field>
@ -354,13 +353,13 @@
<button name="process_start"
states="not running"
string="Compute Segmentation" type="object"
icon="gtk-execute" />
icon="gtk-execute"/>
<button name="process_stop" states="running"
string="Stop Process" type="object"
icon="gtk-cancel" />
icon="gtk-cancel"/>
<button name="process_continue" states="running"
string="Continue Process" type="object"
icon="gtk-go-forward" />
icon="gtk-go-forward"/>
<field name="state" widget="statusbar"/>
</header>
<group col="4">
@ -412,7 +411,7 @@
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new customer segmentation.
Click to define a new customer segmentation.
</p><p>
Create specific categories which you can assign to your
contacts to better manage your interactions with them. The
@ -425,7 +424,7 @@
<menuitem action="crm_segmentation_tree-act"
id="menu_crm_segmentation-act"
groups="base.group_no_one" sequence="15"
parent="base.menu_base_config" />
parent="base.menu_base_config"/>
<!-- menu for the working time -->
<menuitem action="resource.action_resource_calendar_form" id="menu_action_resource_calendar_form" parent="resource.menu_resource_config" sequence="1"/>
@ -466,11 +465,11 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_crm_payment_mode"
id="menu_crm_payment_mode_act"
groups="base.group_no_one"
name="Payment Modes"
parent="base.menu_crm_config_lead" />
parent="base.menu_crm_config_lead"/>
</data>
</openerp>

View File

@ -272,7 +272,7 @@ class abstracted_fs(object):
if path.startswith('/'):
path = path[1:]
p_parts = path.split('/') # hard-code the unix sep here, by spec.
p_parts = path.split(os.sep)
assert '..' not in p_parts

View File

@ -118,7 +118,8 @@ class email_template(osv.osv):
"of the message"),
'subject': fields.char('Subject', translate=True, help="Subject (placeholders may be used here)",),
'email_from': fields.char('From', help="Sender address (placeholders may be used here)"),
'email_to': fields.char('To', help="Comma-separated recipient addresses (placeholders may be used here)"),
'email_to': fields.char('To (Emails)', help="Comma-separated recipient addresses (placeholders may be used here)"),
'email_recipients': fields.char('To (Partners)', help="Comma-separated ids of recipient partners (placeholders may be used here)"),
'email_cc': fields.char('Cc', help="Carbon copy recipients (placeholders may be used here)"),
'reply_to': fields.char('Reply-To', help="Preferred response address (placeholders may be used here)"),
'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing Mail Server', readonly=False,
@ -286,7 +287,7 @@ class email_template(osv.osv):
template = self.get_email_template(cr, uid, template_id, res_id, context)
values = {}
for field in ['subject', 'body_html', 'email_from',
'email_to', 'email_cc', 'reply_to']:
'email_to', 'email_recipients', 'email_cc', 'reply_to']:
values[field] = self.render_template(cr, uid, getattr(template, field),
template.model, res_id, context=context) \
or False

View File

@ -29,7 +29,8 @@
<group>
<group string="Addressing">
<field name="email_from" required="1"/>
<field name="email_to" required="1"/>
<field name="email_to"/>
<field name="email_recipients"/>
<field name="email_cc"/>
<field name="reply_to"/>
<field name="user_signature"/>
@ -77,6 +78,7 @@
<field name="subject"/>
<field name="email_from"/>
<field name="email_to"/>
<field name="email_recipients"/>
<field name="report_name"/>
</tree>
</field>

View File

@ -63,11 +63,16 @@ class test_message_compose(test_mail.TestMailMockups):
# Create template on mail.group, with attachments
group_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'mail.group')])[0]
email_template = self.registry('email.template')
email_template_id = email_template.create(cr, uid, {'model_id': group_model_id,
'name': 'Pigs Template', 'subject': '${object.name}',
'body_html': '${object.description}', 'user_signature': True,
email_template_id = email_template.create(cr, uid, {
'model_id': group_model_id,
'name': 'Pigs Template',
'subject': '${object.name}',
'body_html': '${object.description}',
'user_signature': True,
'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])],
'email_to': 'b@b.b c@c.c', 'email_cc': 'd@d.d'})
'email_to': 'b@b.b c@c.c',
'email_cc': 'd@d.d'
})
# ----------------------------------------
# CASE1: comment and save as template
@ -76,9 +81,9 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': '<p>Dummy body</p>'},
{'default_composition_mode': 'comment', 'default_model': 'mail.group',
{'default_composition_mode': 'comment',
'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]})
compose = mail_compose.browse(cr, uid, compose_id)
@ -97,8 +102,10 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': 'Dummy body'},
{'default_composition_mode': 'comment', 'default_model': 'mail.group',
{'default_composition_mode': 'comment',
'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
'default_use_template': False,
'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]})
compose = mail_compose.browse(cr, uid, compose_id)
@ -135,8 +142,10 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Mass_mail on pigs and bird, with a default_partner_ids set to check he is correctly added
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': 'Dummy body'},
{'default_composition_mode': 'mass_mail', 'default_model': 'mail.group',
{'default_composition_mode': 'mass_mail',
'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
'default_use_template': False,
'default_template_id': email_template_id,
'default_partner_ids': [p_a_id],
'active_ids': [self.group_pigs_id, self.group_bird_id]})
@ -170,3 +179,26 @@ class test_message_compose(test_mail.TestMailMockups):
partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])])
self.assertEqual(set(message_pigs_pids), set(partner_ids), 'mail.message on pigs incorrect number of notified_partner_ids')
self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect')
# ----------------------------------------
# CASE4: test newly introduced email_recipients field
# ----------------------------------------
# get already-created partners back
p_b_id = self.res_partner.search(cr, uid, [('email', '=', 'b@b.b')])[0]
p_c_id = self.res_partner.search(cr, uid, [('email', '=', 'c@c.c')])[0]
p_d_id = self.res_partner.search(cr, uid, [('email', '=', 'd@d.d')])[0]
# modify template: use email_recipients, use template and email address in email_to to test all features together
user_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'res.users')])[0]
email_template.write(cr, uid, [email_template_id], {
'model_id': user_model_id,
'body_html': '${object.login}',
'email_to': '${object.email} c@c',
'email_recipients': '%i,%i' % (p_b_id, p_c_id),
'email_cc': 'd@d',
})
# patner by email + partner by id (no double)
send_to = [p_a_id, p_b_id, p_c_id, p_d_id]
# Generate messsage with default email and partner on template
mail_value = mail_compose.generate_email_for_composer(cr, uid, email_template_id, uid)
self.assertEqual(set(mail_value['partner_ids']), set(send_to), 'mail.message partner_ids list created by template is incorrect')

View File

@ -17,6 +17,7 @@
<group>
<field name="email_from" readonly="1"/>
<field name="email_to" readonly="1"/>
<field name="email_recipients" readonly="1"/>
<field name="email_cc" readonly="1" attrs="{'invisible':[('email_cc','=',False)]}"/>
<field name="reply_to" readonly="1" attrs="{'invisible':[('reply_to','=',False)]}"/>
<field name="subject" readonly="1"/>

View File

@ -52,8 +52,9 @@ class mail_compose_message(osv.TransientModel):
context = {}
result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
result['template_id'] = context.get('default_template_id', context.get('mail.compose.template_id', False))
# pre-render the template if any
if result.get('use_template'):
if result.get('use_template') and result.get('template_id'):
onchange_res = self.onchange_use_template(cr, uid, [], result.get('use_template'), result.get('template_id'),
result.get('composition_mode'), result.get('model'), result.get('res_id'), context=context)
result.update(onchange_res['value'])
@ -65,6 +66,10 @@ class mail_compose_message(osv.TransientModel):
'template_id': fields.selection(_get_templates, 'Template', size=-1),
}
_defaults = {
'use_template': True,
}
def onchange_template_id(self, cr, uid, ids, use_template, template_id, composition_mode, model, res_id, context=None):
""" - use_template not set: return default_get
- use_template set in mass_mailing: we cannot render, so return the template values
@ -148,15 +153,23 @@ class mail_compose_message(osv.TransientModel):
mail.compose.message, transform email_cc and email_to into partner_ids """
template_values = self.pool.get('email.template').generate_email(cr, uid, template_id, res_id, context=context)
# filter template values
fields = ['body', 'body_html', 'subject', 'email_to', 'email_cc', 'attachments']
fields = ['body', 'body_html', 'subject', 'email_to', 'email_recipients', 'email_cc', 'attachments']
values = dict((field, template_values[field]) for field in fields if template_values.get(field))
values['body'] = values.pop('body_html', '')
# transform email_to, email_cc into partner_ids
values['partner_ids'] = []
mails = tools.email_split(values.pop('email_to', '') + ' ' + values.pop('email_cc', ''))
for mail in mails:
partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
values['partner_ids'].append(partner_id)
email_recipients = values.pop('email_recipients', '')
if email_recipients:
for partner_id in email_recipients.split(','):
values['partner_ids'].append(int(partner_id))
values['partner_ids'] = list(set(values['partner_ids']))
return values
def render_message(self, cr, uid, wizard, res_id, context=None):

View File

@ -8,23 +8,23 @@
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//form/group" position="after">
<group attrs="{'invisible':[('use_template','=',False)]}">
<field name="use_template" invisible="1"
on_change="onchange_use_template(use_template, template_id, composition_mode, model, res_id, context)"/>
<field name="template_id"
on_change="onchange_template_id(use_template, template_id, composition_mode, model, res_id, context)"/>
</group>
<xpath expr="//field[@name='content_subtype']" position="after">
<field name="use_template" invisible="1"
on_change="onchange_use_template(use_template, template_id, composition_mode, model, res_id, context)"/>
</xpath>
<xpath expr="//form/footer/button" position="after">
<button icon="/email_template/static/src/img/email_template.png"
type="object" name="toggle_template" string=""
help="Use a message template"
attrs="{'invisible':[('content_subtype','!=','html')]}"/>
<button icon="/email_template/static/src/img/email_template_save.png"
type="object" name="save_as_template" string=""
help="Save as a new template"
attrs="{'invisible':[('content_subtype','!=','html')]}"/>
<xpath expr="//footer" position="inside">
<group class="oe_right" col="1">
<div>Use template
<field name="template_id" attrs="{'invisible':[('use_template','=',False)]}"
nolabel="1"
on_change="onchange_template_id(use_template, template_id, composition_mode, model, res_id, context)"/>
</div>
or
<button icon="/email_template/static/src/img/email_template_save.png"
type="object" name="save_as_template" string="Save as new template" class="oe_link"
help="Save as a new template"
attrs="{'invisible':[('content_subtype','!=','html')]}"/>
</group>
</xpath>
</data>
</field>

View File

@ -158,6 +158,8 @@ class hr_employee(osv.osv):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
_columns = {
#we need a related field in order to be able to sort the employee by name
'name_related': fields.related('resource_id', 'name', type='char', string='Name', readonly=True, store=True),
'country_id': fields.many2one('res.country', 'Nationality'),
'birthday': fields.date("Date of Birth"),
'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
@ -207,6 +209,8 @@ class hr_employee(osv.osv):
'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),
}
_order='name_related'
def create(self, cr, uid, data, context=None):
employee_id = super(hr_employee, self).create(cr, uid, data, context=context)
try:

View File

@ -64,22 +64,22 @@ class hr_expense_expense(osv.osv):
_description = "Expense"
_order = "id desc"
_columns = {
'name': fields.char('Description', size=128),
'name': fields.char('Description', size=128, required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'id': fields.integer('Sheet ID', readonly=True),
'date': fields.date('Date', select=True),
'date': fields.date('Date', select=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Force Journal', help = "The journal used when the expense is done."),
'employee_id': fields.many2one('hr.employee', "Employee", required=True),
'employee_id': fields.many2one('hr.employee', "Employee", required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'user_id': fields.many2one('res.users', 'User', required=True),
'date_confirm': fields.date('Confirmation Date', select=True, help="Date of the confirmation of the sheet expense. It's filled when the button Confirm is pressed."),
'date_valid': fields.date('Validation Date', select=True, help="Date of the acceptation of the sheet expense. It's filled when the button Accept is pressed."),
'user_valid': fields.many2one('res.users', 'Validation By'),
'user_valid': fields.many2one('res.users', 'Validation By', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'account_move_id': fields.many2one('account.move', 'Ledger Posting'),
'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ),
'note': fields.text('Note'),
'amount': fields.function(_amount, string='Total Amount', digits_compute= dp.get_precision('Account')),
'voucher_id': fields.many2one('account.voucher', "Employee's Receipt"),
'currency_id': fields.many2one('res.currency', 'Currency', required=True),
'department_id':fields.many2one('hr.department','Department'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'department_id':fields.many2one('hr.department','Department', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state': fields.selection([
('draft', 'New'),
@ -100,6 +100,12 @@ class hr_expense_expense(osv.osv):
'currency_id': _get_currency,
}
def unlink(self, cr, uid, ids, context=None):
for rec in self.browse(cr, uid, ids, context=context):
if rec.state != 'draft':
raise osv.except_osv(_('Warning!'),_('You can only delete draft expenses!'))
return super(hr_expense_expense, self).unlink(cr, uid, ids, context)
def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None):
res = {'value': {'journal_id': False}}
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context)

View File

@ -359,6 +359,12 @@ class hr_payslip(osv.osv):
def check_done(self, cr, uid, ids, context=None):
return True
def unlink(self, cr, uid, ids, context=None):
for payslip in self.browse(cr, uid, ids, context=context):
if payslip.state not in ['draft','cancel']:
raise osv.except_osv(_('Warning!'),_('You cannot delete a payslip which is not draft or cancelled!'))
return super(hr_payslip, self).unlink(cr, uid, ids, context)
#TODO move this function into hr_contract module, on hr.employee object
def get_contract(self, cr, uid, employee, date_from, date_to, context=None):
"""

View File

@ -75,7 +75,7 @@
<record id="hr_salary_rule_meal_voucher" model="hr.salary.rule">
<field name="amount_select">fix</field>
<field eval="10" name="amount_fix"/>
<field name="quantity">worked_days.WORK100.number_of_days</field>
<field name="quantity">worked_days.WORK100 and worked_days.WORK100.number_of_days</field>
<field name="code">MA</field>
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="register_id" ref="hr_meal_voucher_register"/>
@ -89,7 +89,7 @@
<field name="category_id" ref="hr_payroll.ALW"/>
<field name="name">Get 1% of sales</field>
<field name="sequence" eval="17"/>
<field name="amount_python_compute">result = (inputs.SALEURO.amount + inputs.SALASIA.amount) * 0.01</field>
<field name="amount_python_compute">result = ((inputs.SALEURO and inputs.SALEURO.amount) + (inputs.SALASIA and inputs.SALASIA.amount)) * 0.01</field>
</record>
<!-- Rule Inputs -->

View File

@ -65,6 +65,8 @@ class partner_vat(osv.osv_memory):
partners = []
partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)
if not partner_ids:
raise osv.except_osv(_('Error'),_('No belgian contact with a VAT number in your database.'))
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 account_move_line l
@ -190,7 +192,7 @@ class partner_vat_list(osv.osv_memory):
addr = obj_partner.address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice'])
if addr.get('invoice',False):
ads = obj_partner.browse(cr, uid, [addr['invoice']], context=context)[0]
phone = ads.phone.replace(' ','') or ''
phone = ads.phone and ads.phone.replace(' ','') or ''
email = ads.email or ''
name = ads.name or ''
city = ads.city or ''
@ -259,6 +261,8 @@ class partner_vat_list(osv.osv_memory):
# Turnover and Farmer tags are not included
client_datas = self._get_datas(cr, uid, ids, context=context)
if not client_datas:
raise osv.except_osv(_('Data Insufficient!'),_('No data available for the client.'))
data_client_info = ''
for amount_data in client_datas:
data_client_info += """
@ -309,6 +313,8 @@ class partner_vat_list(osv.osv_memory):
datas['year'] = context['year']
datas['limit_amount'] = context['limit_amount']
datas['client_datas'] = self._get_datas(cr, uid, ids, context=context)
if not datas['client_datas']:
raise osv.except_osv(_('Error!'),_('No record to print.'))
return {
'type': 'ir.actions.report.xml',
'report_name': 'partner.vat.listing.print',

View File

@ -131,8 +131,8 @@
<field name="tax_code_id" ref="tax_acq_196"/>
<field name="tax_sign" eval="-1"/>
<field name="account_collected_id" ref="pcg_44566"/>
<field name="account_paid_id" ref="pcg_44566"/>
<field name="account_collected_id" ref="pcg_445662"/>
<field name="account_paid_id" ref="pcg_445662"/>
<field name="ref_base_code_id" ref="tax_acq_196_ht"/>
<field name="ref_base_sign" eval="1"/>

View File

@ -3903,7 +3903,7 @@
<field name="name">Associés - Comptes courants</field>
<field name="code">455</field>
<field name="type">view</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="user_type" ref="account.data_account_type_payable"/>
<field name="note">Pour frais avancés personnellement</field>
<field name="parent_id" ref="pcg_45"/>
<field name="reconcile" eval="True"/>
@ -3912,8 +3912,8 @@
<record id="pcg_4551" model="account.account.template">
<field name="name">Principal</field>
<field name="code">4551</field>
<field name="type">receivable</field>
<field name="user_type" ref="account.data_account_type_receivable"/>
<field name="type">payable</field>
<field name="user_type" ref="account.data_account_type_payable"/>
<field name="parent_id" ref="pcg_455"/>
<field name="reconcile" eval="True"/>
</record>
@ -3921,8 +3921,8 @@
<record id="pcg_4558" model="account.account.template">
<field name="name">Intérêts courus</field>
<field name="code">4558</field>
<field name="type">receivable</field>
<field name="user_type" ref="account.data_account_type_receivable"/>
<field name="type">payable</field>
<field name="user_type" ref="account.data_account_type_payable"/>
<field name="parent_id" ref="pcg_455"/>
<field name="reconcile" eval="True"/>
</record>

View File

@ -1424,7 +1424,7 @@
<field name="reconcile" eval="True"/>
<field ref="a_15" name="parent_id"/>
</record>
<record id="vat_payable6" model="account.account.template">
<record id="vat_payable_low" model="account.account.template">
<field name="name">Btw af te dragen laag</field>
<field name="code">1601</field>
<field name="type">other</field>
@ -1432,7 +1432,7 @@
<field name="reconcile" eval="False"/>
<field ref="a_15" name="parent_id"/>
</record>
<record id="vat_payable19" model="account.account.template">
<record id="vat_payable_high" model="account.account.template">
<field name="name">Btw af te dragen hoog</field>
<field name="code">1602</field>
<field name="type">other</field>
@ -1448,7 +1448,7 @@
<field name="reconcile" eval="False"/>
<field ref="a_15" name="parent_id"/>
</record>
<record id="vat_refund6" model="account.account.template">
<record id="vat_refund_low" model="account.account.template">
<field name="name">Btw te vorderen laag</field>
<field name="code">1611</field>
<field name="type">other</field>
@ -1456,7 +1456,7 @@
<field name="reconcile" eval="False"/>
<field ref="a_15" name="parent_id"/>
</record>
<record id="vat_refund19" model="account.account.template">
<record id="vat_refund_high" model="account.account.template">
<field name="name">Btw te vorderen hoog</field>
<field name="code">1612</field>
<field name="type">other</field>
@ -3909,7 +3909,7 @@
<record id="btw_code_1a" model="account.tax.code.template">
<field name="code">1a</field>
<field name="parent_id" ref="btw_code_binnenland"/>
<field name="name">Leveringen/diensten belast met 19% (BTW)</field>
<field name="name">Leveringen/diensten belast met 21% (BTW)</field>
</record>
<record id="btw_code_1b" model="account.tax.code.template">
<field name="code">1b</field>
@ -4021,7 +4021,7 @@
<record id="omz_code_1a" model="account.tax.code.template">
<field name="code">1a</field>
<field name="parent_id" ref="omz_code_binnenland"/>
<field name="name">Leveringen/diensten belast met 19% (omzet)</field>
<field name="name">Leveringen/diensten belast met 21% (omzet)</field>
</record>
<record id="omz_code_1b" model="account.tax.code.template">
<field name="code">1b</field>
@ -4149,22 +4149,22 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="description">6% BTW</field>
<field eval="0.06" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_payable6"/>
<field name="account_paid_id" ref="vat_refund6"/>
<field name="account_collected_id" ref="vat_payable_low"/>
<field name="account_paid_id" ref="vat_refund_low"/>
<field name="base_code_id" ref="omz_code_1b"/>
<field name="tax_code_id" ref="btw_code_1b"/>
<field name="ref_base_code_id" ref="omz_code_1b"/>
<field name="ref_tax_code_id" ref="btw_code_1b"/>
<field name="type_tax_use">sale</field>
</record>
<record id="btw_19" model="account.tax.template">
<record id="btw_21" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet hoog</field>
<field name="description">19% BTW</field>
<field eval="0.19" name="amount"/>
<field name="description">21% BTW</field>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field name="base_code_id" ref="omz_code_1a"/>
<field name="tax_code_id" ref="btw_code_1a"/>
<field name="ref_base_code_id" ref="omz_code_1a"/>
@ -4176,10 +4176,10 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet overig</field>
<field name="description">variabel BTW</field>
<field eval="0.19" name="amount"/>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field name="base_code_id" ref="omz_code_1a"/>
<field name="tax_code_id" ref="btw_code_1a"/>
<field name="ref_base_code_id" ref="omz_code_1c"/>
@ -4194,20 +4194,20 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="description">6% BTW</field>
<field eval="0.06" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_refund6"/>
<field name="account_paid_id" ref="vat_payable6"/>
<field name="account_collected_id" ref="vat_refund_low"/>
<field name="account_paid_id" ref="vat_payable_low"/>
<field name="tax_code_id" ref="btw_code_5b"/>
<field name="ref_tax_code_id" ref="btw_code_5b"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="btw_19_buy" model="account.tax.template">
<record id="btw_21_buy" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen hoog (inkopen)</field>
<field name="description">19% BTW</field>
<field eval="0.19" name="amount"/>
<field name="description">21% BTW</field>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field name="tax_code_id" ref="btw_code_5b"/>
<field name="ref_tax_code_id" ref="btw_code_5b"/>
<field name="type_tax_use">purchase</field>
@ -4216,10 +4216,10 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen overig (inkopen)</field>
<field name="description">variabel BTW</field>
<field eval="0.19" name="amount"/>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field name="tax_code_id" ref="btw_code_5b"/>
<field name="ref_tax_code_id" ref="btw_code_5b"/>
<field name="type_tax_use">purchase</field>
@ -4240,8 +4240,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<record id="btw_ink_0" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW af te dragen verlegd (inkopen)</field>
<field name="description">19% BTW verlegd</field>
<field eval="0.19" name="amount"/>
<field name="description">21% BTW verlegd</field>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_payable_verlegd"/>
<field name="account_paid_id" ref="vat_refund_verlegd"/>
@ -4277,8 +4277,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<record id="btw_ink2_0" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen verlegd (inkopen)</field>
<field name="description">19% BTW verlegd</field>
<field eval="0.19" name="amount"/>
<field name="description">21% BTW verlegd</field>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_refund_verlegd"/>
<field name="account_paid_id" ref="vat_payable_verlegd"/>
@ -4330,8 +4330,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_6"/>
<field name="account_collected_id" ref="vat_payable6"/>
<field name="account_paid_id" ref="vat_payable6"/>
<field name="account_collected_id" ref="vat_payable_low"/>
<field name="account_paid_id" ref="vat_payable_low"/>
<field eval="btw_code_4b" name="tax_code_id"/>
<field eval="btw_code_4b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4342,43 +4342,43 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_6"/>
<field name="account_collected_id" ref="vat_refund6"/>
<field name="account_paid_id" ref="vat_refund6"/>
<field name="account_collected_id" ref="vat_refund_low"/>
<field name="account_paid_id" ref="vat_refund_low"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="btw_I_19" model="account.tax.template">
<record id="btw_I_21" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU hoog</field>
<field name="description">19% BTW import binnen EU</field>
<field eval="0.19" name="amount"/>
<field name="description">21% BTW import binnen EU</field>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field eval="True" name="child_depend"/>
<field eval="omz_code_4b" name="base_code_id"/>
<field eval="omz_code_4b" name="ref_base_code_id"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="btw_I_19_1" model="account.tax.template">
<record id="btw_I_21_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU hoog(1)</field>
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_19"/>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="parent_id" ref="btw_I_21"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field eval="btw_code_4b" name="tax_code_id"/>
<field eval="btw_code_4b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
</record>
<record id="btw_I_19_2" model="account.tax.template">
<record id="btw_I_21_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU hoog(2)</field>
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_19"/>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="parent_id" ref="btw_I_21"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4400,8 +4400,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_overig"/>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field eval="btw_code_4b" name="tax_code_id"/>
<field eval="btw_code_4b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4412,8 +4412,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_I_overig"/>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4463,8 +4463,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E1"/>
<field name="account_collected_id" ref="vat_payable6"/>
<field name="account_paid_id" ref="vat_payable6"/>
<field name="account_collected_id" ref="vat_payable_low"/>
<field name="account_paid_id" ref="vat_payable_low"/>
<field eval="btw_code_4a" name="tax_code_id"/>
<field eval="btw_code_4a" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4475,8 +4475,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E1"/>
<field name="account_collected_id" ref="vat_refund6"/>
<field name="account_paid_id" ref="vat_refund6"/>
<field name="account_collected_id" ref="vat_refund_low"/>
<field name="account_paid_id" ref="vat_refund_low"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4485,7 +4485,7 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU hoog</field>
<field name="description">BTW import buiten EU</field>
<field eval="0.19" name="amount"/>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field eval="True" name="child_depend"/>
<field eval="omz_code_4a" name="base_code_id"/>
@ -4498,8 +4498,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E2"/>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field eval="btw_code_4a" name="tax_code_id"/>
<field eval="btw_code_4a" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4510,8 +4510,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E2"/>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4520,7 +4520,7 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU overig</field>
<field name="description">BTW import buiten EU</field>
<field eval="0.19" name="amount"/>
<field eval="0.21" name="amount"/>
<field name="type">percent</field>
<field eval="True" name="child_depend"/>
<field eval="omz_code_4a" name="base_code_id"/>
@ -4533,8 +4533,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="-1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E_overig"/>
<field name="account_collected_id" ref="vat_payable19"/>
<field name="account_paid_id" ref="vat_payable19"/>
<field name="account_collected_id" ref="vat_payable_high"/>
<field name="account_paid_id" ref="vat_payable_high"/>
<field eval="btw_code_4a" name="tax_code_id"/>
<field eval="btw_code_4a" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>
@ -4545,8 +4545,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge
<field eval="1.00" name="amount"/>
<field name="type">percent</field>
<field name="parent_id" ref="btw_E_overig"/>
<field name="account_collected_id" ref="vat_refund19"/>
<field name="account_paid_id" ref="vat_refund19"/>
<field name="account_collected_id" ref="vat_refund_high"/>
<field name="account_paid_id" ref="vat_refund_high"/>
<field eval="btw_code_5b" name="tax_code_id"/>
<field eval="btw_code_5b" name="ref_tax_code_id"/>
<field name="type_tax_use">purchase</field>

View File

@ -75,7 +75,7 @@ class pos_make_payment(osv.osv_memory):
def launch_payment(self, cr, uid, ids, context=None):
return {
'name': _('Paiement'),
'name': _('Payment'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.make.payment',
@ -83,6 +83,7 @@ class pos_make_payment(osv.osv_memory):
'target': 'new',
'views': False,
'type': 'ir.actions.act_window',
'context': context,
}
def print_report(self, cr, uid, ids, context=None):

View File

@ -657,9 +657,9 @@ class product_product(osv.osv):
# Performing a quick memory merge of ids in Python will give much better performance
ids = set()
ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context))
if len(ids) < limit:
if not limit or len(ids) < limit:
# we may underrun the limit because of dupes in the results, that's fine
ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids)), context=context))
ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit and (limit-len(ids)) or False) , context=context))
ids = list(ids)
if not ids:
ptrn = re.compile('(\[(.*?)\])')

View File

@ -45,12 +45,13 @@ class stock_production_lot(osv.osv):
_columns = {
'life_date': fields.datetime('End of Life Date',
help='The date on which the lot may become dangerous and should not be consumed.'),
help='This is the date on which the goods with this Serial Number may become dangerous and must not be consumed.'),
'use_date': fields.datetime('Best before Date',
help='The date on which the lot starts deteriorating without becoming dangerous.'),
help='This is the date on which the goods with this Serial Number start deteriorating, without being dangerous yet.'),
'removal_date': fields.datetime('Removal Date',
help='The date on which the lot should be removed.'),
'alert_date': fields.datetime('Alert Date', help="The date on which an alert should be notified about the serial number."),
help='This is the date on which the goods with this Serial Number should be removed from the stock.'),
'alert_date': fields.datetime('Alert Date',
help="This is the date on which an alert should be notified about the goods with this Serial Number."),
}
# Assign dates according to products data
def create(self, cr, uid, vals, context=None):
@ -78,12 +79,13 @@ class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
'life_time': fields.integer('Product Life Time',
help='The number of days before a serial number may become dangerous and should not be consumed.'),
help='When a new a Serial Number is issued, this is the number of days before the goods may become dangerous and must not be consumed.'),
'use_time': fields.integer('Product Use Time',
help='The number of days before a serial number starts deteriorating without becoming dangerous.'),
help='When a new a Serial Number is issued, this is the number of days before the goods starts deteriorating, without being dangerous yet.'),
'removal_time': fields.integer('Product Removal Time',
help='The number of days before a serial number should be removed.'),
'alert_time': fields.integer('Product Alert Time', help="The number of days after which an alert should be notified about the serial number."),
help='When a new a Serial Number is issued, this is the number of days before the goods should be removed from the stock.'),
'alert_time': fields.integer('Product Alert Time',
help='When a new a Serial Number is issued, this is the number of days before an alert should be notified.'),
}
product_product()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -474,7 +474,7 @@ def Project():
resource = %s
""" % (
project.id,
project.date_start, working_days,
project.date_start or time.strftime('%Y-%m-%d'), working_days,
'|'.join(['User_'+str(x) for x in puids])
)
vacation = calendar_id and tuple(resource_pool.compute_vacation(cr, uid, calendar_id, context=context)) or False

View File

@ -40,7 +40,7 @@
<field name="name">Automated Purchase Order Notification Mail</field>
<field name="email_from">${object.validator.email or ''}</field>
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
<field name="email_to">${object.partner_id.email}</field>
<field name="email_recipients">${object.partner_id.id}</field>
<field name="model_id" ref="purchase.model_purchase_order"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[

View File

@ -395,6 +395,7 @@ class purchase_order(osv.osv):
'default_res_id': ids[0],
'default_use_template': True,
'default_template_id': template_id,
'default_composition_mode': 'comment',
})
return {
'view_type': 'form',

View File

@ -25,7 +25,7 @@
<field name="name">Automated Sale Order Notification Mail</field>
<field name="email_from">${object.user_id.email or ''}</field>
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
<field name="email_to">${object.partner_invoice_id.email}</field>
<field name="email_recipients">${object.partner_invoice_id.id}</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[

View File

@ -281,6 +281,7 @@ class sale_order(osv.osv):
}
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None):
context = context or {}
if not pricelist_id:
return {}
value = {
@ -617,6 +618,7 @@ class sale_order(osv.osv):
}
def action_wait(self, cr, uid, ids, context=None):
context = context or {}
for o in self.browse(cr, uid, ids):
if not o.order_line:
raise osv.except_osv(_('Error!'),_('You cannot confirm a sale order which has no line.'))
@ -645,6 +647,7 @@ class sale_order(osv.osv):
'default_res_id': ids[0],
'default_use_template': True,
'default_template_id': template_id,
'default_composition_mode': 'comment',
'mark_so_as_sent': True
})
return {

View File

@ -64,7 +64,9 @@ class crm_make_sale(osv.osv_memory):
"""
if context is None:
context = {}
# update context: if come from phonecall, default state values can make the quote crash lp:1017353
context.pop('default_state', False)
case_obj = self.pool.get('crm.lead')
sale_obj = self.pool.get('sale.order')
partner_obj = self.pool.get('res.partner')

View File

@ -1553,7 +1553,7 @@ class stock_production_lot(osv.osv):
'product_id': lambda x, y, z, c: c.get('product_id', False),
}
_sql_constraints = [
('name_ref_uniq', 'unique (name, ref)', 'The combination of serial number and internal reference must be unique !'),
('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'),
]
def action_traceability(self, cr, uid, ids, context=None):
""" It traces the information of a product
@ -2433,14 +2433,17 @@ class stock_move(osv.osv):
if move.picking_id:
picking_ids.append(move.picking_id.id)
if move.move_dest_id.id and (move.state != 'done'):
self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
#cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
if move.move_dest_id.state in ('waiting', 'confirmed'):
self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
if move.move_dest_id.picking_id:
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
if move.move_dest_id.auto_validate:
self.action_done(cr, uid, [move.move_dest_id.id], context=context)
# Downstream move should only be triggered if this move is the last pending upstream move
other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
('move_dest_id','=',move.move_dest_id.id)], context=context)
if not other_upstream_move_ids:
self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
if move.move_dest_id.state in ('waiting', 'confirmed'):
self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
if move.move_dest_id.picking_id:
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
if move.move_dest_id.auto_validate:
self.action_done(cr, uid, [move.move_dest_id.id], context=context)
self._create_product_valuation_moves(cr, uid, move, context=context)
if move.state not in ('confirmed','done','assigned'):