Skip to content

Commit

Permalink
[MERGE] forward port of branch 8.0 up to a5419ca
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Jul 15, 2014
2 parents bcfa4c8 + a5419ca commit b7ba498
Show file tree
Hide file tree
Showing 151 changed files with 8,078 additions and 9,061 deletions.
9 changes: 8 additions & 1 deletion addons/account/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ def _sum_period(self, cr, uid, ids, name, args, context):
_name = 'account.tax.code'
_description = 'Tax Code'
_rec_name = 'code'
_order = 'sequence, code'
_columns = {
'name': fields.char('Tax Case Name', required=True, translate=True),
'code': fields.char('Case Code', size=64),
Expand Down Expand Up @@ -2653,7 +2654,7 @@ class account_tax_code_template(osv.osv):

_name = 'account.tax.code.template'
_description = 'Tax Code Template'
_order = 'code'
_order = 'sequence, code'
_rec_name = 'code'
_columns = {
'name': fields.char('Tax Case Name', required=True),
Expand All @@ -2663,6 +2664,11 @@ class account_tax_code_template(osv.osv):
'child_ids': fields.one2many('account.tax.code.template', 'parent_id', 'Child Codes'),
'sign': fields.float('Sign For Parent', required=True),
'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any tax related to this tax Code to appear on invoices."),
'sequence': fields.integer(
'Sequence', help=(
"Determine the display order in the report 'Accounting "
"\ Reporting \ Generic Reporting \ Taxes \ Taxes Report'"),
),
}

_defaults = {
Expand Down Expand Up @@ -2695,6 +2701,7 @@ def generate_tax_code(self, cr, uid, tax_code_root_id, company_id, context=None)
'parent_id': tax_code_template.parent_id and ((tax_code_template.parent_id.id in tax_code_template_ref) and tax_code_template_ref[tax_code_template.parent_id.id]) or False,
'company_id': company_id,
'sign': tax_code_template.sign,
'sequence': tax_code_template.sequence,
}
#check if this tax code already exists
rec_list = obj_tax_code.search(cr, uid, [('name', '=', vals['name']),('code', '=', vals['code']),('company_id', '=', vals['company_id'])], context=context)
Expand Down
2 changes: 2 additions & 0 deletions addons/account/account_bank_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@ def process_reconciliation(self, cr, uid, id, mv_line_dicts, context=None):
st_line_currency_rate = st_line.currency_id and statement_currency.id == company_currency.id and (st_line.amount_currency / st_line.amount) or False
to_create = []
for mv_line_dict in mv_line_dicts:
if mv_line_dict.get('is_tax_line'):
continue
mv_line_dict['ref'] = move_name
mv_line_dict['move_id'] = move_id
mv_line_dict['period_id'] = st_line.statement_id.period_id.id
Expand Down
35 changes: 22 additions & 13 deletions addons/account/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,35 +1230,43 @@ def create(self, cr, uid, vals, context=None, check=True):
if vals.get('account_tax_id', False):
tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
total = vals['debit'] - vals['credit']
if journal.type in ('purchase_refund', 'sale_refund'):
base_code = 'base_code_id'
tax_code = 'tax_code_id'
account_id = 'account_collected_id'
base_sign = 'base_sign'
tax_sign = 'tax_sign'
if journal.type in ('purchase_refund', 'sale_refund') or (journal.type in ('cash', 'bank') and total < 0):
base_code = 'ref_base_code_id'
tax_code = 'ref_tax_code_id'
account_id = 'account_paid_id'
base_sign = 'ref_base_sign'
tax_sign = 'ref_tax_sign'
else:
base_code = 'base_code_id'
tax_code = 'tax_code_id'
account_id = 'account_collected_id'
base_sign = 'base_sign'
tax_sign = 'tax_sign'
tmp_cnt = 0
for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=True).get('taxes'):
for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=False).get('taxes'):
#create the base movement
if tmp_cnt == 0:
if tax[base_code]:
tmp_cnt += 1
self.write(cr, uid,[result], {
if tax_id.price_include:
total = tax['price_unit']
newvals = {
'tax_code_id': tax[base_code],
'tax_amount': tax[base_sign] * abs(total)
})
'tax_amount': tax[base_sign] * abs(total),
}
if tax_id.price_include:
if tax['price_unit'] < 0:
newvals['credit'] = abs(tax['price_unit'])
else:
newvals['debit'] = tax['price_unit']
self.write(cr, uid, [result], newvals, context=context)
else:
data = {
'move_id': vals['move_id'],
'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''),
'date': vals['date'],
'partner_id': vals.get('partner_id',False),
'ref': vals.get('ref',False),
'partner_id': vals.get('partner_id', False),
'ref': vals.get('ref', False),
'statement_id': vals.get('statement_id', False),
'account_tax_id': False,
'tax_code_id': tax[base_code],
'tax_amount': tax[base_sign] * abs(total),
Expand All @@ -1275,6 +1283,7 @@ def create(self, cr, uid, vals, context=None, check=True):
'date': vals['date'],
'partner_id': vals.get('partner_id',False),
'ref': vals.get('ref',False),
'statement_id': vals.get('statement_id', False),
'account_tax_id': False,
'tax_code_id': tax[tax_code],
'tax_amount': tax[tax_sign] * abs(tax['amount']),
Expand Down
6 changes: 3 additions & 3 deletions addons/account/account_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
<h1><field name="name"/></h1>
<group>
<group>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" attrs="{'readonly': [('move_line_ids', '!=', [])]}" widget="selection"/>
<label for="date" string="Date / Period"/>
<div>
<field name="date" on_change="onchange_date(date, company_id)" class="oe_inline"/>
Expand Down Expand Up @@ -702,9 +702,9 @@
</div>
<group>
<group>
<field name="account_id"/>
<field name="account_id" domain="[('type', 'not in', ['view', 'closed', 'consolidation'])]"/>
<field name="amount_type"/>
<field name="tax_id"/>
<field name="tax_id" domain="[('type_tax_use', 'in', ['purchase', 'all']), ('parent_id', '=', False)]"/>
</group>
<group>
<field name="label"/>
Expand Down
33 changes: 21 additions & 12 deletions addons/account/static/src/js/account_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ openerp.account = function (instance) {
relation: "account.account",
string: _t("Account"),
type: "many2one",
domain: [['type','!=','view']],
domain: [['type','not in',['view', 'closed', 'consolidation']]],
},
},
label: {
Expand Down Expand Up @@ -81,6 +81,7 @@ openerp.account = function (instance) {
relation: "account.tax",
string: _t("Tax"),
type: "many2one",
domain: [['type_tax_use','in',['purchase', 'all']], ['parent_id', '=', false]],
},
},
amount: {
Expand Down Expand Up @@ -1149,10 +1150,17 @@ openerp.account = function (instance) {
deferred_tax = $.when(self.model_tax
.call("compute_for_bank_reconciliation", [self.tax_id_field.get("value"), amount]))
.then(function(data){
var tax = data.taxes[0];
var tax_account_id = (amount > 0 ? tax.account_collected_id : tax.account_paid_id)
line_created_being_edited[0].amount_with_tax = line_created_being_edited[0].amount;
line_created_being_edited[0].amount = (data.total.toFixed(3) === amount.toFixed(3) ? amount : data.total);
line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true, currency_id: self.st_line.currency_id};
var current_line_cursor = 1;
$.each(data.taxes, function(index, tax){
if (tax.amount !== 0.0) {
var tax_account_id = (amount > 0 ? tax.account_collected_id : tax.account_paid_id)
tax_account_id = tax_account_id !== false ? tax_account_id: line_created_being_edited[0].account_id
line_created_being_edited[current_line_cursor] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true, currency_id: self.st_line.currency_id, is_tax_line: true};
current_line_cursor = current_line_cursor + 1;
};
});
}
);
} else {
Expand All @@ -1164,10 +1172,10 @@ openerp.account = function (instance) {

$.when(deferred_tax).then(function(){
// Format amounts
if (line_created_being_edited[0].amount)
line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount), line_created_being_edited[0].currency_id);
if (line_created_being_edited[1] && line_created_being_edited[1].amount)
line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount), line_created_being_edited[0].currency_id);
$.each(line_created_being_edited, function(index, val) {
if (val.amount)
line_created_being_edited[index].amount_str = self.formatCurrency(Math.abs(val.amount), val.currency_id);
});
self.set("line_created_being_edited", line_created_being_edited);
self.createdLinesChanged(); // TODO For some reason, previous line doesn't trigger change handler
});
Expand Down Expand Up @@ -1318,13 +1326,14 @@ openerp.account = function (instance) {
// idem
prepareCreatedMoveLineForPersisting: function(line) {
var dict = {};

if (dict['account_id'] === undefined)
dict['account_id'] = line.account_id;
dict['name'] = line.label;
if (line.amount > 0) dict['credit'] = line.amount;
if (line.amount < 0) dict['debit'] = -1*line.amount;
if (line.tax_id) dict['tax_code_id'] = line.tax_id;
var amount = line.tax_id ? line.amount_with_tax: line.amount;
if (amount > 0) dict['credit'] = amount;
if (amount < 0) dict['debit'] = -1 * amount;
if (line.tax_id) dict['account_tax_id'] = line.tax_id;
if (line.is_tax_line) dict['is_tax_line'] = line.is_tax_line;
if (line.analytic_account_id) dict['analytic_account_id'] = line.analytic_account_id;

return dict;
Expand Down
6 changes: 3 additions & 3 deletions addons/board/static/src/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
add_dashboard: function(){
var self = this;
if (! this.view.view_manager.action || ! this.$el.find("select").val()) {
this.do_warn("Can't find dashboard action");
this.do_warn(_t("Can't find dashboard action"));
return;
}
var data = this.view.build_search_data();
Expand Down Expand Up @@ -399,10 +399,10 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
name: this.$el.find("input").val()
}).done(function(r) {
if (r === false) {
self.do_warn("Could not add filter to dashboard");
self.do_warn(_t("Could not add filter to dashboard"));
} else {
self.$el.toggleClass('oe_opened');
self.do_notify("Filter added to dashboard", '');
self.do_notify(_t("Filter added to dashboard"), '');
}
});
},
Expand Down
31 changes: 16 additions & 15 deletions addons/crm/report/crm_lead_report_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,22 @@
<field name="date_closed"/>
</group>
<group expand="1" string="Group By">
<filter string="Salesperson" name="user" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_assigned_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
<filter string="Grade" name="group_grade" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'grade_id'}" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" />
<filter string="Assign Date (day)" icon="terp-go-today" domain="[]" context="{'group_by':'date_assign:day'}"/>
<filter string="Assign Date (month)" icon="terp-go-month" domain="[]" context="{'group_by':'date_assign:month'}"/>
<filter string="Assign Date (year)" icon="terp-go-year" domain="[]" context="{'group_by':'date_assign:year'}"/>
<filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/>
<filter string="Partner" context="{'group_by':'partner_id'}" />
<filter string="Country" context="{'group_by':'country_id'}" />
<filter string="Company" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Type" domain="[]" context="{'group_by':'type'}"/>
<filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" domain="[]" context="{'group_by':'priority'}" />
<separator orientation="vertical" />
<filter string="Creation date (day)" domain="[]" context="{'group_by':'create_date:day'}"/>
<filter string="Creation date (week)" domain="[]" context="{'group_by':'create_date:week'}"/>
<filter string="Creation date (month)" domain="[]" context="{'group_by':'create_date:month'}" name="month"/>
<filter string="Creation date (year)" domain="[]" context="{'group_by':'create_date:year'}"/>
<separator orientation="vertical" />
<filter string="Exp. Closing" domain="[]" context="{'group_by':'date_deadline'}"/>
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" />
</group>
</search>
</field>
Expand Down
6 changes: 5 additions & 1 deletion addons/event_sale/event_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ def product_id_change(self, cr, uid, ids,
if product:
product_res = self.pool.get('product.product').browse(cr, uid, product, context=context)
if product_res.event_ok:
res['value'].update({'event_type_id': product_res.event_type_id.id, 'event_ok':product_res.event_ok})
res['value'].update(event_type_id=product_res.event_type_id.id,
event_ok=product_res.event_ok)
else:
res['value'].update(event_type_id=False,
event_ok=False)
return res

def button_confirm(self, cr, uid, ids, context=None):
Expand Down
1 change: 1 addition & 0 deletions addons/hr/hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def unlink(self, cr, uid, ids, context=None):
resource_ids = []
for employee in self.browse(cr, uid, ids, context=context):
resource_ids.append(employee.resource_id.id)
super(hr_employee, self).unlink(cr, uid, ids, context=context)
return self.pool.get('resource.resource').unlink(cr, uid, resource_ids, context=context)

def onchange_address_id(self, cr, uid, ids, address, context=None):
Expand Down
Loading

0 comments on commit b7ba498

Please sign in to comment.