From f98a4d45af6088fc8a4e3268f3c92c57de51cdd0 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 18 Jan 2017 13:30:40 +0100 Subject: [PATCH 1/4] [FIX] account_asset_invoice: setting account_id on an invoice line with an asset Thanks to this commit: 342dad44cd78e1567bc9e7ae95a75be8adb26c4e (1) Asset Account (2) Depreciation Entries: Asset Account (3) Depreciation Entries: Expense Account Now it's possible in 9.0 to set the account_income_recognition_id. So in the case of a vendor bill if the account_income_recognition_id(3) is set, it means that the depreciation entries are debited on this account(3). Then the asset account can be used on the invoice line. NB: When the account_income_recognition_id(3) is not set, it means that The Asset Account(1) is used to debit the depreciation entries so it cannot be used as an asset account. In this case, (1) is used as (3) And the Depreciation Entries: Asset Account(2) is used as (1) and (2) because the all assets are first debited on this account and progressively the depreciation entries are credited on this account too. This is why in 10.0, there is an onchange on account_asset_id on model "account.asset.category" which sets the same value for (1) and (2). Example with account_income_recognition_id set: Purchase of 100k with a 5 years depreciation: on (1) debit=100k and credit=0 on (2) each year debit=0 and credit=20k on (3) each year debit=20k and credit=0 Example without account_income_recognition_id set: Purchase of 100k with a 5 years depreciation: on (2) debit=100k and credit=0 on (2) each year debit=0 and credit=20k on (1) each year debit=20k and credit=0 This behavior can be analysed in function create_move on model "account.asset.depreciation.line" opw:702265 --- addons/account_asset/account_asset_invoice.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset_invoice.py b/addons/account_asset/account_asset_invoice.py index 2460afd3fea..fe7ab4c7d44 100644 --- a/addons/account_asset/account_asset_invoice.py +++ b/addons/account_asset/account_asset_invoice.py @@ -77,7 +77,11 @@ class AccountInvoiceLine(models.Model): if self.invoice_id.type == 'out_invoice' and self.asset_category_id: self.account_id = self.asset_category_id.account_asset_id.id elif self.invoice_id.type == 'in_invoice' and self.asset_category_id: - self.account_id = self.asset_category_id.account_depreciation_id.id + #DO NOT FORWARDPORT + if self.asset_category_id.account_income_recognition_id: + self.account_id = self.asset_category_id.account_asset_id.id + else: + self.account_id = self.asset_category_id.account_depreciation_id.id @api.onchange('uom_id') def _onchange_uom_id(self): From 23b2bba925c6bf2aac37c49bd2bdb3463f47e8a6 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 18 Jan 2017 13:31:02 +0100 Subject: [PATCH 2/4] [FIX] calendar: private events By default, an event can be modified by any employee. This is also the case for private events, displayed as "Busy" to other users. However, since any user can modify an event, nothing prevents him to change the privacy setting in order to be able to see the content. This commit introduces a global record rule which only allows the followers of an event to modify it. opw-705079 --- addons/calendar/security/calendar_security.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/calendar/security/calendar_security.xml b/addons/calendar/security/calendar_security.xml index 80eb79553a0..4636ec94bc8 100644 --- a/addons/calendar/security/calendar_security.xml +++ b/addons/calendar/security/calendar_security.xml @@ -23,5 +23,15 @@ + + + Private events + ['|', ('class', '!=', 'private'), '&', ('class', '=', 'private'), ('partner_ids', 'in', user.partner_id.id)] + + + + + + From 16349661e3f2466c9f3e37496478de4605d3be10 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 16 Jan 2017 17:29:55 +0100 Subject: [PATCH 3/4] [CLA] signature for dansanti --- doc/cla/individual/dansanti.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/cla/individual/dansanti.md diff --git a/doc/cla/individual/dansanti.md b/doc/cla/individual/dansanti.md new file mode 100644 index 00000000000..a13d64b6e27 --- /dev/null +++ b/doc/cla/individual/dansanti.md @@ -0,0 +1,9 @@ +Chile, 2016-05-31 + +I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Daniel Santibáñez Polanco dansanti@gmail.com https://github.com/dansanti \ No newline at end of file From bbdf9605e4c480e1fc19b1faac9cfc4321bcaea2 Mon Sep 17 00:00:00 2001 From: dansanti Date: Tue, 31 May 2016 14:04:54 -0400 Subject: [PATCH 4/4] [FIX] openerp: Field One2many child propagation on NewId dict If exist an one2many field as child of another field, this one2many get only empty lines and Javascript dataset set wrong referid, causing a bad query with False values and 'one2many_v_id'$ as inverse_id. This PR adetect on convert_to_change if field is one2many and fnames = None, in case True, set fnames with one2many model's fields This commit closes #12249, closes #11236 Courtsey of @rco-odoo for review --- openerp/addons/test_new_api/tests/test_onchange.py | 7 ++++++- openerp/fields.py | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openerp/addons/test_new_api/tests/test_onchange.py b/openerp/addons/test_new_api/tests/test_onchange.py index 88e481c3052..9876d631044 100644 --- a/openerp/addons/test_new_api/tests/test_onchange.py +++ b/openerp/addons/test_new_api/tests/test_onchange.py @@ -307,7 +307,12 @@ class TestOnChange(common.TransactionCase): # When one2many domain contains non-computed field, things are ok self.assertEqual(result['value']['important_messages'], - [(5,)] + [(4, msg.id) for msg in discussion.important_messages]) + [(5,)] + [(1, msg.id, { + 'name': msg.name, + 'body': msg.body, + 'author': (msg.author.id, msg.author.display_name), + 'size': msg.size + }) for msg in discussion.important_messages]) # But here with commit 5676d81, we get value of: [(2, email.id)] self.assertEqual( diff --git a/openerp/fields.py b/openerp/fields.py index 6ccc6325f83..635d5db10ad 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -1915,9 +1915,8 @@ class One2many(_RelationalMulti): _column_limit = property(attrgetter('limit')) def convert_to_onchange(self, value, fnames=None): - if fnames: - # do not serialize self's inverse field - fnames = [name for name in fnames if name != self.inverse_name] + fnames = set(fnames or value.fields_view_get()['fields']) + fnames.discard(self.inverse_name) return super(One2many, self).convert_to_onchange(value, fnames)