[MERGE] forward port branch 10.0 up to 0e28db88d1
This commit is contained in:
@@ -821,6 +821,9 @@ class AccountBankStatementLine(models.Model):
|
||||
}
|
||||
st_line.process_reconciliation(new_aml_dicts=[vals])
|
||||
|
||||
def _get_communication(self, payment_method_id):
|
||||
return self.name or ''
|
||||
|
||||
def process_reconciliation(self, counterpart_aml_dicts=None, payment_aml_rec=None, new_aml_dicts=None):
|
||||
""" Match statement lines with existing payments (eg. checks) and/or payables/receivables (eg. invoices and refunds) and/or new move lines (eg. write-offs).
|
||||
If any new journal item needs to be created (via new_aml_dicts or counterpart_aml_dicts), a new journal entry will be created and will contain those
|
||||
@@ -918,7 +921,7 @@ class AccountBankStatementLine(models.Model):
|
||||
'state': 'reconciled',
|
||||
'currency_id': currency.id,
|
||||
'amount': abs(total),
|
||||
'communication': self.name or '',
|
||||
'communication': self._get_communication(payment_methods[0] if payment_methods else False),
|
||||
'name': self.statement_id.name,
|
||||
})
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="product.group_uom" attrs="{'readonly': [('has_moves', '=', True)]}"/>
|
||||
<button type="action"
|
||||
name="%(mrp.action_change_production_qty)d"
|
||||
string="Update" states="confirmed,planned,progress" class="oe_link" attrs="{'invisible': [('state','=','done')]}"/>
|
||||
string="Update" states="confirmed,planned,progress" class="oe_link"/>
|
||||
</div>
|
||||
<field name="bom_id"
|
||||
domain="['&', '|',
|
||||
|
||||
@@ -143,3 +143,15 @@ class StockSettings(models.TransientModel):
|
||||
warehouses.mapped('int_type_id').write({'active': active})
|
||||
|
||||
return True
|
||||
|
||||
@api.model
|
||||
def get_default_decimal_precision(self, fields):
|
||||
# don't forward-port in v11.0, the API of config wizards changed.
|
||||
digits = self.env.ref('product.decimal_stock_weight').digits
|
||||
return {'decimal_precision': digits}
|
||||
|
||||
@api.multi
|
||||
def set_decimal_precision(self):
|
||||
# don't forward-port in v11.0, the API of config wizards changed.
|
||||
for record in self:
|
||||
self.env.ref('product.decimal_stock_weight').write({'digits': record.decimal_precision})
|
||||
|
||||
@@ -697,6 +697,30 @@ class TestFields(common.TransactionCase):
|
||||
self.assertFalse(discussion.very_important_messages)
|
||||
self.assertFalse(message.exists())
|
||||
|
||||
def test_70_x2many_write(self):
|
||||
discussion = self.env.ref('test_new_api.discussion_0')
|
||||
Message = self.env['test_new_api.message']
|
||||
# There must be 3 messages, 0 important
|
||||
self.assertEqual(len(discussion.messages), 3)
|
||||
self.assertEqual(len(discussion.important_messages), 0)
|
||||
self.assertEqual(len(discussion.very_important_messages), 0)
|
||||
discussion.important_messages = [(0, 0, {
|
||||
'body': 'What is the answer?',
|
||||
'important': True,
|
||||
})]
|
||||
# There must be 4 messages, 1 important
|
||||
self.assertEqual(len(discussion.messages), 4)
|
||||
self.assertEqual(len(discussion.important_messages), 1)
|
||||
self.assertEqual(len(discussion.very_important_messages), 1)
|
||||
discussion.very_important_messages |= Message.new({
|
||||
'body': '42',
|
||||
'important': True,
|
||||
})
|
||||
# There must be 5 messages, 2 important
|
||||
self.assertEqual(len(discussion.messages), 5)
|
||||
self.assertEqual(len(discussion.important_messages), 2)
|
||||
self.assertEqual(len(discussion.very_important_messages), 2)
|
||||
|
||||
|
||||
class TestHtmlField(common.TransactionCase):
|
||||
|
||||
|
||||
+4
-5
@@ -2208,14 +2208,13 @@ class One2many(_RelationalMulti):
|
||||
elif act[0] == 6:
|
||||
record = records[-1]
|
||||
comodel.browse(act[2]).write({inverse: record.id})
|
||||
query = "SELECT id FROM %s WHERE %s=%%s AND id <> ALL(%%s)" % (comodel._table, inverse)
|
||||
comodel._cr.execute(query, (record.id, act[2] or [0]))
|
||||
lines = comodel.browse([row[0] for row in comodel._cr.fetchall()])
|
||||
domain = self.domain(records) if callable(self.domain) else self.domain
|
||||
domain = domain + [(inverse, 'in', records.ids), ('id', 'not in', act[2] or [0])]
|
||||
inverse_field = comodel._fields[inverse]
|
||||
if inverse_field.ondelete == 'cascade':
|
||||
lines.unlink()
|
||||
comodel.search(domain).unlink()
|
||||
else:
|
||||
lines.write({inverse: False})
|
||||
comodel.search(domain).write({inverse: False})
|
||||
|
||||
|
||||
class Many2many(_RelationalMulti):
|
||||
|
||||
Reference in New Issue
Block a user