[MERGE] forward port of branch saas-3 up to e1e7dc0

This commit is contained in:
Christophe Simonis 2014-12-01 15:42:51 +01:00
commit d37dd37059
10 changed files with 47 additions and 18 deletions

View File

@ -1620,7 +1620,7 @@ class res_partner(models.Model):
_inherit = 'res.partner'
invoice_ids = fields.One2many('account.invoice', 'partner_id', string='Invoices',
readonly=True)
readonly=True, copy=False)
def _find_accounting_partner(self, partner):
'''

View File

@ -34,14 +34,14 @@
<field name="inherit_id" ref="account.view_account_tax_template_form"/>
<field name="arch" type="xml">
<field position="after" name="price_include">
<field groups="base.group_extended" name="tax_discount"/>
<field name="tax_discount"/>
</field>
<field name="tax_code_id" position="replace" >
<field name="tax_code_id" on_change="onchange_tax_code_id(tax_code_id)" />
</field>
<field position="after" name="amount">
<field groups="base.group_extended" name="base_reduction"/>
<field groups="base.group_extended" name="amount_mva"/>
<field position="after" name="tax_discount">
<field name="base_reduction"/>
<field name="amount_mva"/>
</field>
</field>
</record>
@ -52,14 +52,14 @@
<field name="inherit_id" ref="account.view_tax_form"/>
<field name="arch" type="xml">
<field position="after" name="price_include">
<field groups="base.group_extended" name="tax_discount"/>
<field name="tax_discount"/>
</field>
<field name="tax_code_id" position="replace" >
<field name="tax_code_id" on_change="onchange_tax_code_id(tax_code_id)" />
</field>
<field position="after" name="amount">
<field groups="base.group_extended" name="base_reduction"/>
<field groups="base.group_extended" name="amount_mva"/>
<field position="after" name="tax_discount">
<field name="base_reduction"/>
<field name="amount_mva"/>
</field>
</field>
</record>

View File

@ -40,7 +40,7 @@ The campaigns are dynamic and multi-channels. The process is as follows:
send, reports to print and send by email, custom actions
* Define input segments that will select the items that should enter the
campaign (e.g leads from certain countries.)
* Run you campaign in simulation mode to test it real-time or accelerated,
* Run your campaign in simulation mode to test it real-time or accelerated,
and fine-tune it
* You may also start the real campaign in manual mode, where each action
requires manual validation

View File

@ -154,6 +154,7 @@ class product_uom(osv.osv):
_defaults = {
'active': 1,
'rounding': 0.01,
'factor': 1,
'uom_type': 'reference',
}
@ -179,10 +180,7 @@ class product_uom(osv.osv):
raise osv.except_osv(_('Error!'), _('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name,to_unit.name,))
else:
return qty
# First round to the precision of the original unit, so that
# float representation errors do not bias the following ceil()
# e.g. with 1 / (1/12) we could get 12.0000048, ceiling to 13!
amount = float_round(qty/from_unit.factor, precision_rounding=from_unit.rounding)
amount = qty/from_unit.factor
if to_unit:
amount = amount * to_unit.factor
if round:

View File

@ -595,7 +595,7 @@
<field name="factor"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','smaller')],
'readonly':[('uom_type','!=','smaller')]}"/>
'readonly':[('uom_type','=','bigger')]}"/>
<field name="factor_inv"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','bigger')],

View File

@ -12,7 +12,10 @@ class TestUom(TransactionCase):
def test_10_conversion(self):
cr, uid = self.cr, self.uid
gram_id = self.imd.get_object_reference(cr, uid, 'product', 'product_uom_gram')[1]
kg_id = self.imd.get_object_reference(cr, uid, 'product', 'product_uom_kgm')[1]
tonne_id = self.imd.get_object_reference(cr, uid, 'product', 'product_uom_ton')[1]
unit_id = self.imd.get_object_reference(cr, uid, 'product','product_uom_unit')[1]
dozen_id = self.imd.get_object_reference(cr, uid, 'product','product_uom_dozen')[1]
qty = self.uom._compute_qty(cr, uid, gram_id, 1020000, tonne_id)
self.assertEquals(qty, 1.02, "Converted quantity does not correspond.")
@ -20,6 +23,20 @@ class TestUom(TransactionCase):
price = self.uom._compute_price(cr, uid, gram_id, 2, tonne_id)
self.assertEquals(price, 2000000.0, "Converted price does not correspond.")
# If the conversion factor for Dozens (1/12) is not stored with sufficient precision,
# the conversion of 1 Dozen into Units will give e.g. 12.00000000000047 Units
# and the Unit rounding will round that up to 13.
# This is a partial regression test for rev. 311c77bb, which is further improved
# by rev. fa2f7b86.
qty = self.uom._compute_qty(cr, uid, dozen_id, 1, unit_id)
self.assertEquals(qty, 12.0, "Converted quantity does not correspond.")
# Regression test for side-effect of commit 311c77bb - converting 1234 Grams
# into Kilograms should work even if grams are rounded to 1.
self.uom.write(cr, uid, gram_id, {'rounding': 1})
qty = self.uom._compute_qty(cr, uid, gram_id, 1234, kg_id)
self.assertEquals(qty, 1.234, "Converted quantity does not correspond.")
def test_20_rounding(self):
cr, uid = self.cr, self.uid
unit_id = self.imd.get_object_reference(cr, uid, 'product', 'product_uom_unit')[1]

View File

@ -118,7 +118,9 @@ class project_work(osv.osv):
vals_line['user_id'] = vals['user_id']
vals_line['product_id'] = result['product_id']
if vals.get('date'):
vals_line['date' ] = vals['date'][:10]
timestamp = datetime.datetime.strptime(vals['date'], tools.DEFAULT_SERVER_DATETIME_FORMAT)
ts = fields.datetime.context_timestamp(cr, uid, timestamp, context)
vals_line['date'] = ts.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
# Calculate quantity based on employee's product's uom
vals_line['unit_amount'] = vals['hours']

View File

@ -538,6 +538,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
},
reload_record: function (record) {
var self = this;
var fields = this.fields_view.fields;
return this.dataset.read_ids(
[record.get('id')],
_.pluck(_(this.columns).filter(function (r) {
@ -550,8 +551,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
self.records.remove(record);
return;
}
_(_.keys(values)).each(function(key){
record.set(key, values[key], {silent: true});
_.each(values, function (value, key) {
if (fields[key] && fields[key].type === 'many2many')
record.set(key + '__display', false, {silent: true});
record.set(key, value, {silent: true});
});
record.trigger('change', record);
});

View File

@ -183,6 +183,7 @@ class res_partner_bank(osv.osv):
try:
if not data.get('bank_name'):
data['bank_name'] = _('BANK')
data = dict((k, v or '') for (k, v) in data.iteritems())
name = bank_code_format[data['state']] % data
except Exception:
raise osv.except_osv(_("Formating Error"), _("Invalid Bank Account Type Name format."))

View File

@ -524,6 +524,14 @@ class res_partner(osv.Model, format_address):
if not parent.is_company:
parent.write({'is_company': True})
def unlink(self, cr, uid, ids, context=None):
orphan_contact_ids = self.search(cr, uid,
[('parent_id', 'in', ids), ('id', 'not in', ids), ('use_parent_address', '=', True)], context=context)
if orphan_contact_ids:
# no longer have a parent address
self.write(cr, uid, orphan_contact_ids, {'use_parent_address': False}, context=context)
return super(res_partner, self).unlink(cr, uid, ids, context=context)
def _clean_website(self, website):
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(website)
if not scheme: