From 79aa02650c22d951e7245cbf7a9c77574deeb895 Mon Sep 17 00:00:00 2001 From: "Amit (OpenERP)" Date: Sat, 28 Apr 2012 18:21:25 +0530 Subject: [PATCH 01/12] [FIX] product : Set the missing dependecy of mail module to product module lp bug: https://launchpad.net/bugs/990474 fixed bzr revid: amp@tinyerp.com-20120428125125-1unkvn70pz1wys6i --- addons/product/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index 9b4d2cadee1..918545aa783 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -25,7 +25,7 @@ "version" : "1.1", "author" : "OpenERP SA", 'category': 'Sales Management', - "depends" : ["base", "process", "decimal_precision"], + "depends" : ["base", "process", "decimal_precision", "mail"], "init_xml" : [], "demo_xml" : ["product_demo.xml"], "description": """ From 2911d6a8c5532310e07b3b593d78c43653190137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?= Date: Thu, 21 Jun 2012 12:40:18 +0200 Subject: [PATCH 02/12] [IMP] Provide _prepare* hooks in bank statement object for the entries creations of account.move.line from a statement line bzr revid: joel.grandguillaume@camptocamp.com-20120621104018-ryylbaxh6696e0rc --- addons/account/account_bank_statement.py | 247 +++++++++++++++++------ 1 file changed, 184 insertions(+), 63 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 1f47a6be9bd..97d10bfc022 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -205,7 +205,182 @@ class account_bank_statement(osv.osv): def button_dummy(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {}, context=context) + def _prepare_move(self, cr, uid, st_line, st_line_number, context=None): + """Prepare the dict of values to create the move from a + statement line. This method may be overridden to implement custom + move generation (making sure to call super() to establish + a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :param char st_line_number: will be used as the name of the generated account move + :return: dict of value to create() the account.move + """ + move_vals = { + 'journal_id': st_line.statement_id.journal_id.id, + 'period_id': st_line.statement_id.period_id.id, + 'date': st_line.date, + 'name': st_line_number, + 'ref': st_line.ref, + } + return move_vals + + def _prepare_bank_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, + context=None): + """Compute the args to build the dict of values to create the bank move line from a + statement line by calling the _prepare_move_line_vals. This method may be + overridden to implement custom move generation (making sure to call super() to + establish a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :param int/long move_id: ID of the account.move to link the move line + :param float amount: amount of the move line + :param int/long company_currency_id: ID of currency of the concerned company + :return: dict of value to create() the bank account.move.line + """ + anl_id = st_line.analytic_account_id and st_line.analytic_account_id.id or False + debit = ((amount<0) and -amount) or 0.0 + credit = ((amount>0) and amount) or 0.0 + cur_id = False + amt_cur = False + if st_line.statement_id.currency.id <> company_currency_id: + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st.currency.id, amount, context=context) + amt_cur = -amount_cur + if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: + cur_id = st_line.account_id.currency_id.id + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st_line.account_id.currency_id.id, amount, context=context) + amt_cur = -amount_cur + + res = self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, + amount_currency=amt_cur, currency_id=cur_id, analytic_id = anl_id, context=context) + return res + + def _get_counter_part_account(sefl, cr, uid, st_line, context=None): + """Retrieve the account to use in the counterpart move. + This method may be overridden to implement custom move generation (making sure to + call super() to establish a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :return: int/long of the account.account to use as counterpart + """ + account_id = False + if st_line.amount >= 0: + account_id = st_line.statement_id.journal_id.default_credit_account_id.id + else: + account_id = st_line.statement_id.journal_id.default_debit_account_id.id + return account_id + + def _get_counter_part_partner(sefl, cr, uid, st_line, context=None): + """Retrieve the partner to use in the counterpart move. + This method may be overridden to implement custom move generation (making sure to + call super() to establish a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :return: int/long of the res.partner to use as counterpart + """ + import pdb;pdb.set_trace() + partner_id = ((st_line.partner_id) and st_line.partner_id.id) or False + return partner_id + + + def _prepare_counterpart_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, + context=None): + """Compute the args to build the dict of values to create the counter part move line from a + statement line by calling the _prepare_move_line_vals. This method may be + overridden to implement custom move generation (making sure to call super() to + establish a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :param int/long move_id: ID of the account.move to link the move line + :param float amount: amount of the move line + :param int/long account_id: ID of account to use as counter part + :param int/long company_currency_id: ID of currency of the concerned company + :return: dict of value to create() the bank account.move.line + """ + account_id = self._get_counter_part_account(cr, uid, st_line, context=context) + partner_id = self._get_counter_part_partner(cr, uid, st_line, context=context) + debit = ((amount > 0) and amount) or 0.0 + credit = ((amount < 0) and -amount) or 0.0 + cur_id = False + amt_cur = False + if st_line.statement_id.currency.id <> company_currency_id: + amt_cur = st_line.amount + cur_id = st_line.statement_id.currency.id + res = self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, + amount_currency = amt_cur, currency_id = cur_id, account_id = account_id, + partner_id = partner_id, context=context) + return res + + def _prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, credit, currency_id = False, + amount_currency= False, account_id = False, analytic_id = False, + partner_id = False, context=None): + """Prepare the dict of values to create the move line from a + statement line. All non-mandatory args will replace the default computed one. + This method may be overridden to implement custom move generation (making sure to + call super() to establish a clean extension chain). + + :param browse_record st_line: account.bank.statement.line record to + create the move from. + :param int/long move_id: ID of the account.move to link the move line + :param float debit: debit amount of the move line + :param float credit: credit amount of the move line + :param int/long currency_id: ID of currency of the move line to create + :param float amount_currency: amount of the debit/credit expressed in the currency_id + :param int/long account_id: ID of the account to use in the move line if different + from the statement line account ID + :param int/long analytic_id: ID of analytic account to put on the move line + :param int/long partner_id: ID of the partner to put on the move line + :return: dict of value to create() the account.move.line + """ + acc_id = (st_line.account_id) and st_line.account_id.id + cur_id = st_line.statement_id.currency.id + par_id = ((st_line.partner_id) and st_line.partner_id.id) or False + anl_acc_id = False + am_curr = False + amount_currency = False + if account_id: + acc_id = account_id + if currency_id: + cur_id = currency_id + if amount_currency: + am_curr = amount_currency + if analytic_id: + anl_acc_id = analytic_id + if partner_id: + par_id = partner_id + ml_val = { + 'name': st_line.name, + 'date': st_line.date, + 'ref': st_line.ref, + 'move_id': move_id, + 'partner_id': partner_id, + 'account_id': acc_id, + 'credit': credit, + 'debit': debit, + 'statement_id': st_line.statement_id.id, + 'journal_id': st_line.statement_id.journal_id.id, + 'period_id': st_line.statement_id.period_id.id, + 'currency_id': cur_id, + 'amount_currency': am_curr, + 'analytic_account_id': anl_acc_id, + } + return ml_val + def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): + """Create the account move from the statement line using the _prepare_bank_move_line and + _prepare_counterpart_move_line hook methods. + :param int/long st_line: ID of the account.bank.statement.line to create the move from. + :param int/long company_currency_id: ID of the res.currency of the company + :param char st_line_number: will be used as the name of the generated account move + :return: ID of the account.move created + """ + if context is None: context = {} res_currency_obj = self.pool.get('res.currency') @@ -217,82 +392,28 @@ class account_bank_statement(osv.osv): context.update({'date': st_line.date}) - move_id = account_move_obj.create(cr, uid, { - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'date': st_line.date, - 'name': st_line_number, - 'ref': st_line.ref, - }, context=context) + move_vals = self._prepare_move(cr, uid, st_line, st_line_number, context=context) + move_id = account_move_obj.create(cr, uid, move_vals, context=context) account_bank_statement_line_obj.write(cr, uid, [st_line.id], { 'move_ids': [(4, move_id, False)] }) - torec = [] - if st_line.amount >= 0: - account_id = st.journal_id.default_credit_account_id.id - else: - account_id = st.journal_id.default_debit_account_id.id - acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id + context.update({ 'res.currency.compute.account': acc_cur, }) amount = res_currency_obj.compute(cr, uid, st.currency.id, company_currency_id, st_line.amount, context=context) - val = { - 'name': st_line.name, - 'date': st_line.date, - 'ref': st_line.ref, - 'move_id': move_id, - 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, - 'account_id': (st_line.account_id) and st_line.account_id.id, - 'credit': ((amount>0) and amount) or 0.0, - 'debit': ((amount<0) and -amount) or 0.0, - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'currency_id': st.currency.id, - 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False - } - - if st.currency.id <> company_currency_id: - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st.currency.id, amount, context=context) - val['amount_currency'] = -amount_cur - - if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: - val['currency_id'] = st_line.account_id.currency_id.id - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st_line.account_id.currency_id.id, amount, context=context) - val['amount_currency'] = -amount_cur - - move_line_id = account_move_line_obj.create(cr, uid, val, context=context) + bank_move_val = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount, + company_currency_id, context=context) + move_line_id = account_move_line_obj.create(cr, uid, bank_move_val, context=context) torec.append(move_line_id) - # Fill the secondary amount/currency - # if currency is not the same than the company - amount_currency = False - currency_id = False - if st.currency.id <> company_currency_id: - amount_currency = st_line.amount - currency_id = st.currency.id - account_move_line_obj.create(cr, uid, { - 'name': st_line.name, - 'date': st_line.date, - 'ref': st_line.ref, - 'move_id': move_id, - 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, - 'account_id': account_id, - 'credit': ((amount < 0) and -amount) or 0.0, - 'debit': ((amount > 0) and amount) or 0.0, - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'amount_currency': amount_currency, - 'currency_id': currency_id, - }, context=context) + counterpart_move_val = self._prepare_counterpart_move_line(cr, uid, st_line, move_id, + amount, company_currency_id, context=context) + account_move_line_obj.create(cr, uid, counterpart_move_val, context=context) for line in account_move_line_obj.browse(cr, uid, [x.id for x in account_move_obj.browse(cr, uid, move_id, From 28908bea003e11e2df7ccedc58f9a0fbee159bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?= Date: Thu, 21 Jun 2012 13:49:16 +0200 Subject: [PATCH 03/12] [FIX] Remove pdb... no comment... bzr revid: joel.grandguillaume@camptocamp.com-20120621114916-a0uy3ipru8usgzo0 --- addons/account/account_bank_statement.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 97d10bfc022..ece18a016fe 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -283,7 +283,6 @@ class account_bank_statement(osv.osv): create the move from. :return: int/long of the res.partner to use as counterpart """ - import pdb;pdb.set_trace() partner_id = ((st_line.partner_id) and st_line.partner_id.id) or False return partner_id From e72f791b1321fb6d4496488ccf062ff92f710010 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Wed, 18 Jul 2012 16:27:08 +0200 Subject: [PATCH 04/12] improved style of kanban vignette dropdown menu bzr revid: mit@openerp.com-20120718142708-5okzuclspou6khot --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- addons/web_kanban/static/src/css/kanban.css | 19 +++++++------------ addons/web_kanban/static/src/css/kanban.sass | 19 ++++++++----------- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 0a3d24d41f4..8ee9bad823c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -599,6 +599,7 @@ float: none; display: block; position: relative; + padding: 2px 12px; } .openerp .oe_dropdown_menu > li:hover { background-color: #f0f0fa; @@ -615,7 +616,6 @@ .openerp .oe_dropdown_menu > li > a { white-space: nowrap; display: block; - padding: 4px 15px; color: #4c4c4c; text-decoration: none; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index fb67945a02d..fe1e8cfe8d2 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -483,10 +483,10 @@ $sheet-max-width: 860px float: none display: block position: relative + padding: 2px 12px > a white-space: nowrap display: block - padding: 4px 15px color: #4c4c4c text-decoration: none &:hover diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 5a7c1b84067..51cdc568a1e 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -359,6 +359,9 @@ .openerp .oe_kanban_view .oe_kanban_card .oe_dropdown_kanban { margin-top: 4px; } +.openerp .oe_kanban_view .oe_kanban_card .oe_dropdown_kanban .oe_kanban_project_times li { + float: left; +} .openerp .oe_kanban_view .oe_kanban_star { float: left; position: inline-block; @@ -401,9 +404,6 @@ position: relative; top: 2px; } -.openerp .oe_kanban_view .oe_kanban_project_times li { - float: left; -} .openerp .oe_kanban_view .oe_kanban_status { position: relative; top: 4px; @@ -471,30 +471,25 @@ visibility: hidden; } .openerp .oe_kanban_view .oe_kanban_colorpicker { - padding: 3px 6px; white-space: nowrap; } .openerp .oe_kanban_view .oe_kanban_colorpicker li { float: left; + margin: 0; + padding: 0; } .openerp .oe_kanban_view .oe_kanban_colorpicker li a { display: inline-block; - width: 18px; - height: 18px; + width: 16px; + height: 16px; border: 1px solid white; } .openerp .oe_kanban_view .oe_kanban_colorpicker li a:hover { border: 1px solid gray !important; } .openerp .oe_kanban_view .oe_kanban_colorpicker li:first-child a { - margin-top: 1px; - height: 16px; border: 1px solid #cccccc; } -.openerp .oe_kanban_view .oe_kanban_colorpicker li:first-child a:hover { - margin-top: 0px; - height: 18px; -} .openerp .oe_kanban_view .oe_kanban_color_0 { background-color: white; } diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index cea95f2ce53..6478ea5b213 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -307,6 +307,10 @@ text-decoration: none .oe_dropdown_kanban margin-top: 4px + .oe_kanban_project_times + li + float: left + .oe_kanban_star float: left position: inline-block @@ -337,9 +341,6 @@ position: relative top: 2px - .oe_kanban_project_times li - float: left - .oe_kanban_status position: relative top: 4px @@ -387,24 +388,20 @@ // }}} // KanbanColorPicker {{{ .oe_kanban_colorpicker - padding: 3px 6px white-space: nowrap .oe_kanban_colorpicker li float: left + margin: 0 + padding: 0 a display: inline-block - width: 18px - height: 18px + width: 16px + height: 16px border: 1px solid white a:hover border: 1px solid gray !important .oe_kanban_colorpicker li:first-child a - margin-top: 1px - height: 16px border: 1px solid #ccc - &:hover - margin-top: 0px - height: 18px // }}} // KanbanColors {{{ .oe_kanban_color_0 From 8632675b82ed1b4cc50a3a48b02fb40dd316d3d6 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Wed, 18 Jul 2012 16:35:39 +0200 Subject: [PATCH 05/12] re alignment of dropdown menu bzr revid: mit@openerp.com-20120718143539-0b1abwzq24f66s50 --- addons/web/static/src/css/base.css | 4 ++-- addons/web/static/src/css/base.sass | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 8ee9bad823c..e96bb2666f5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -584,7 +584,7 @@ z-index: 1; border: 1px solid #afafb6; background: white; - padding: 6px 0; + padding: 4px 0; min-width: 140px; text-align: left; -moz-border-radius: 3px; @@ -599,7 +599,7 @@ float: none; display: block; position: relative; - padding: 2px 12px; + padding: 2px 8px; } .openerp .oe_dropdown_menu > li:hover { background-color: #f0f0fa; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index fe1e8cfe8d2..d860fc69189 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -470,7 +470,7 @@ $sheet-max-width: 860px z-index: 1 border: 1px solid #afafb6 background: white - padding: 6px 0 + padding: 4px 0 min-width: 140px text-align: left @include radius(3px) @@ -483,7 +483,7 @@ $sheet-max-width: 860px float: none display: block position: relative - padding: 2px 12px + padding: 2px 8px > a white-space: nowrap display: block From cf6af909fb8f36f0a4ced1a3b61379d9d4899e34 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Thu, 19 Jul 2012 17:28:04 +0200 Subject: [PATCH 06/12] fixed visual glitch in topbar dropdown menu bzr revid: mit@openerp.com-20120719152804-zcxvuaicpzfubdv1 --- addons/web/static/src/css/base.css | 3 ++- addons/web/static/src/css/base.sass | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index e96bb2666f5..12f0de62b8c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -945,11 +945,12 @@ } .openerp .oe_topbar .oe_dropdown_menu li { float: none; + padding: 3px 12px; } .openerp .oe_topbar .oe_dropdown_menu li a { color: #eeeeee; } -.openerp .oe_topbar .oe_dropdown_menu li a:hover { +.openerp .oe_topbar .oe_dropdown_menu li:hover { background-color: #292929; background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#191919)); background-image: -webkit-linear-gradient(top, #292929, #191919); diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index d860fc69189..58fd8734fa7 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -735,11 +735,12 @@ $sheet-max-width: 860px @include background-clip() li float: none + padding: 3px 12px a color: #eee - &:hover - @include vertical-gradient(#292929, #191919) - @include box-shadow(none) + &:hover + @include vertical-gradient(#292929, #191919) + @include box-shadow(none) // }}} // Webclient.leftbar {{{ From bd538220f36bd7b4c58c158ed3c831bd6b510af6 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Thu, 19 Jul 2012 17:36:05 +0200 Subject: [PATCH 07/12] fixed offset of topbar dropdown menu bzr revid: mit@openerp.com-20120719153605-ivanvuvl3mv88bl3 --- addons/web/static/src/js/chrome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 094e2f184e6..2ab4b61d9c0 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -910,7 +910,7 @@ instance.web.WebClient = instance.web.Widget.extend({ var doc_width = $(document).width(); var offset = $menu.offset(); var menu_width = $menu.width(); - var x = doc_width - offset.left - menu_width - 15; + var x = doc_width - offset.left - menu_width - 2; if (x < 0) { $menu.offset({ left: offset.left + x }).width(menu_width); } From 3c1dd6c0c2a985eebbbfb99b18a98f1151cdfd6d Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Thu, 19 Jul 2012 17:58:37 +0200 Subject: [PATCH 08/12] fixed cursor too close to search icon in searchview bzr revid: mit@openerp.com-20120719155837-g64bmhzesl7ode8t --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 12f0de62b8c..7c8085046fc 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1438,7 +1438,7 @@ outline: none; } .openerp .oe_searchview .oe_searchview_facets .oe_searchview_input { - padding: 0 3px; + padding: 0 0 0 6px; } .openerp .oe_searchview .oe_searchview_facets .oe_searchview_facet { position: relative; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 58fd8734fa7..b3ff70b72bd 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1127,7 +1127,7 @@ $sheet-max-width: 860px &:focus outline: none .oe_searchview_input - padding: 0 3px + padding: 0 0 0 6px .oe_searchview_facet position: relative cursor: pointer From bff386ea36d2d24c21b16d4ed17db0c6d039bd3d Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Thu, 19 Jul 2012 18:04:56 +0200 Subject: [PATCH 09/12] fixed alignment of 'add to dashboard' button in searchview bzr revid: mit@openerp.com-20120719160456-vp9hip9f67d1ij84 --- addons/web/static/src/css/base.css | 6 +++--- addons/web/static/src/css/base.sass | 14 +++++++------- addons/web/static/src/xml/base.xml | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 7c8085046fc..eda3a996d23 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1601,14 +1601,14 @@ .openerp .oe_searchview .oe_searchview_drawer .oe_searchview_section li:hover { background-color: #f0f0fa; } -.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_section form { +.openerp .oe_searchview .oe_searchview_drawer form { margin-left: 12px; } -.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_section form p { +.openerp .oe_searchview .oe_searchview_drawer form p { margin: 4px 0; line-height: 18px; } -.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_section form button { +.openerp .oe_searchview .oe_searchview_drawer form button { margin: 0 0 8px 0; } .openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index b3ff70b72bd..dbd3d30f453 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1249,13 +1249,13 @@ $sheet-max-width: 860px // after oe_selected so background color is not overridden &:hover background-color: $hover-background - form - margin-left: 12px - p - margin: 4px 0 - line-height: 18px - button - margin: 0 0 8px 0 + form + margin-left: 12px + p + margin: 4px 0 + line-height: 18px + button + margin: 0 0 8px 0 .oe_searchview_custom padding: 0 8px 8px 8px form diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 0ade5dd4d89..1bbffe3e2a7 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1392,8 +1392,8 @@

Add to Dashboard

- - +

+
From fceb94cb8ac1af2fdb6f88e6b86632552075baf1 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Tue, 24 Jul 2012 15:46:52 +0200 Subject: [PATCH 10/12] Changed style of About dialog box to match login page style bzr revid: mit@openerp.com-20120724134652-t783h7glntytr3kv --- addons/web/static/src/css/base.css | 41 +++++++++++++++++++++++++- addons/web/static/src/css/base.sass | 25 +++++++++++++++- addons/web/static/src/img/pattern.png | Bin 98 -> 0 bytes addons/web/static/src/js/chrome.js | 2 +- addons/web/static/src/xml/base.xml | 27 ++++++++--------- 5 files changed, 78 insertions(+), 17 deletions(-) delete mode 100644 addons/web/static/src/img/pattern.png diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index eda3a996d23..3b2fb526144 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -267,6 +267,45 @@ color: black; text-decoration: none; } +.openerp.ui-dialog .oe_about { + background-color: white; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); + -moz-border-radius: 0 0 2px 2px; + -webkit-border-radius: 0 0 2px 2px; + border-radius: 0 0 2px 2px; +} +.openerp.ui-dialog .oe_about a { + color: #8a89ba; +} +.openerp.ui-dialog .oe_about a:hover { + text-decoration: underline; +} +.openerp.ui-dialog .oe_about .oe_logo { + margin-left: -6px; +} +.openerp.ui-dialog .oe_about .oe_bottom { + position: absolute; + top: 50%; + left: 0; + right: 0; + bottom: 0; + text-shadow: 0 1px 1px #999999; + background-color: #b41616; + background-image: -webkit-gradient(linear, left top, left bottom, from(#b41616), to(#600606)); + background-image: -webkit-linear-gradient(top, #b41616, #600606); + background-image: -moz-linear-gradient(top, #b41616, #600606); + background-image: -ms-linear-gradient(top, #b41616, #600606); + background-image: -o-linear-gradient(top, #b41616, #600606); + background-image: linear-gradient(to bottom, #b41616, #600606); + color: #eeeeee; + padding: 0 16px; + -moz-border-radius: 0 0 2px 2px; + -webkit-border-radius: 0 0 2px 2px; + border-radius: 0 0 2px 2px; +} +.openerp.ui-dialog .oe_about .oe_bottom a { + color: #eeeeee; +} .openerp.ui-dialog.oe_act_window .ui-dialog-content { padding: 0px; } @@ -711,7 +750,7 @@ z-index: 1050; } .openerp .oe_login { - background: url("/web/static/src/img/pattern.png") repeat; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); text-align: center; font-size: 14px; height: 100%; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index dbd3d30f453..de0ab08391b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -256,6 +256,29 @@ $sheet-max-width: 860px &:hover color: black text-decoration: none + .oe_about + background-color: white + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) + @include radius(0 0 2px 2px) + a + color: #8A89BA + &:hover + text-decoration: underline + .oe_logo + margin-left: -6px + .oe_bottom + position: absolute + top: 50% + left: 0 + right: 0 + bottom: 0 + text-shadow: 0 1px 1px #999999 + @include vertical-gradient(#b41616, #600606) + color: #eee + padding: 0 16px + @include radius(0 0 2px 2px) + a + color: #eee &.ui-dialog.oe_act_window .ui-dialog-content @@ -567,7 +590,7 @@ $sheet-max-width: 860px // }}} // Login {{{ .oe_login - background: url("/web/static/src/img/pattern.png") repeat + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=) text-align: center font-size: 14px height: 100% diff --git a/addons/web/static/src/img/pattern.png b/addons/web/static/src/img/pattern.png deleted file mode 100644 index 7e3a2b3783419e6e5d6caf570adad0ff72359ab3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^tRT$61|)m))t&+=O-~oc5DwYonlCRd*0Y%$V0!fV v!-oT{tgNh(GauNfu!T8pD4QUr(#pdyMTNya*NmeZsENVT)z4*}Q$iB}iHRDp diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 2ab4b61d9c0..28dc9020c4e 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -851,7 +851,7 @@ instance.web.UserMenu = instance.web.Widget.extend({ window.location.href, 'debug'); }); instance.web.dialog($help, {autoOpen: true, - modal: true, width: 960, title: _t("About")}); + modal: true, width: 580, height: 290, resizable: false, title: _t("About")}); }); }, }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 1bbffe3e2a7..da19e6da0a3 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -329,21 +329,20 @@ -
- Activate the developer mode -

OpenERP

-

Version

-

- Copyright © 2004-TODAY OpenERP SA. All Rights Reserved.
- OpenERP is a trademark of the OpenERP SA Company. -

-

- Licenced under the terms of GNU Affero General Public License -

-

- For more information visit OpenERP.com -

+ +
+ Activate the developer mode + +

Version

+ +
+

Copyright © 2004-TODAY OpenERP SA. All Rights Reserved.
+ OpenERP is a trademark of the OpenERP SA Company.

+

Licenced under the terms of GNU Affero General Public License

+

For more information visit OpenERP.com

+
+
From a4f1ce69ab01818fce1a23fc3744865bcc4fd85c Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Wed, 25 Jul 2012 10:04:39 +0200 Subject: [PATCH 11/12] [FIX] throbber use an image. fva will fix the aliasing. Also check http://commons.wikimedia.org/wiki/Category:Throbbers bzr revid: al@openerp.com-20120725080439-j7f44tb0fbp90cm0 --- addons/web/__openerp__.py | 1 - addons/web/static/src/img/throbber.gif | Bin 673 -> 7625 bytes addons/web/static/src/js/coresetup.js | 28 ++----------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index 4051e607e21..9e8e258dedc 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -20,7 +20,6 @@ "static/lib/jquery.form/jquery.form.js", "static/lib/jquery.validate/jquery.validate.js", "static/lib/jquery.ba-bbq/jquery.ba-bbq.js", - "static/lib/spinjs/spin.js", "static/lib/jquery.blockUI/jquery.blockUI.js", "static/lib/jquery.ui/js/jquery-ui-1.8.17.custom.min.js", "static/lib/jquery.ui.timepicker/js/jquery-ui-timepicker-addon.js", diff --git a/addons/web/static/src/img/throbber.gif b/addons/web/static/src/img/throbber.gif index ded8d36d48686558e7fd498eff3b6cc47b8a648a..7ab8346ce0957a729a712adc2a61a97166f4252c 100644 GIT binary patch literal 7625 zcmeHM`&(1jw%vJ$B!=(`8;qFnGSC2liZ}F7PZ9{GfogcwK(S^cwutsNqPF;Go1GT{ zf<{1$)uSPVHXzm*v0_^_4?uhz4_LJHJla5!QhQn{wJr7Ze!VN{cfWIgz<=O=ckZ<} z{5a=WV~#cE%DU$Y1UX0~6bb!|K*1nG!G{dKWHJLR5HNTGpFnV6PGEsZNdYhTrle%1 zWP->EteilI!4d~Qfxj}a0#PC>2}EUJRaOSy$}N>!0&C0mE!zXJEARwk|E~S}gD?1_ z(}5R!17R|O7ko{oj=<^&#))9`^qe@+)6;Y23|MC_1lEOMT)uqa0(dW9zC1Dl*2u_h z@QmCJ#J$`1?%n&JKj7bcp9h{`d=-p`!T9+hcz*u*x8HvI9i#vM{+~pE^BZ-&q^vYg zB$s5R^KlqZBGAmN4SctUZue1$RrRQK3G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y literal 673 zcmZ?wbhEHb6krfw_{6~Q|NnnuW8-t@&ZVcP0~w8tjk9LWTE2X_;(u;G*N|Xm#{gF& zJp*P&1_lPje^Smxsfi`2DGKG8B^e5dS&0=n`H3ldnR#jX42nNlIJtnTbbuIWv;YGG zvoXi6JO2z$d1ebIb69am&SCePk;dt|(eThNk(md#=_MRFRCqx*TEg<~GImP|9(J$n z=N>>?FwHRmnd8@^s36_KvwOp{E|)^5z>ow(NreO-*J!B~H8NXE@4royU~f>kF7c?% zS#p!Aik1*IgUmQ~87XU@ay&8N%#<*Fw$@}BzAut~A3dECXRI!e`M`B%^In-_E3}y+ z--`cXY(C6yv@%6%{(cs0Mgjenq^f<&sBPk#Ibrdw-OD&z6?s?;UD^|61XsB=ZMZ1U zoD>xM*;d}bLPx6q#F8RQAFO^e;@DNBuI=?aMdX9TXP-tMwX(wrF-aj)T3dF?Wkfn@ zoe-L1lcsR Date: Wed, 25 Jul 2012 10:25:39 +0200 Subject: [PATCH 12/12] [FIX] account: bank statement, fixed some glitches in previous refactoring (unknown variables 'st' and 'res_currency_obj') + code optimization and refactoring bzr revid: qdp-launchpad@openerp.com-20120725082539-qqi2jrr35xgz37z5 --- addons/account/account_bank_statement.py | 75 ++++++++---------------- 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index b9fbc3727a0..11bcf565260 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -184,15 +184,14 @@ class account_bank_statement(osv.osv): :param char st_line_number: will be used as the name of the generated account move :return: dict of value to create() the account.move """ - move_vals = { + return { 'journal_id': st_line.statement_id.journal_id.id, 'period_id': st_line.statement_id.period_id.id, 'date': st_line.date, 'name': st_line_number, 'ref': st_line.ref, } - return move_vals - + def _prepare_bank_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, context=None): """Compute the args to build the dict of values to create the bank move line from a @@ -213,17 +212,15 @@ class account_bank_statement(osv.osv): cur_id = False amt_cur = False if st_line.statement_id.currency.id <> company_currency_id: - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st.currency.id, amount, context=context) - amt_cur = -amount_cur + cur_id = st_line.statement_id.currency.id if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: cur_id = st_line.account_id.currency_id.id - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st_line.account_id.currency_id.id, amount, context=context) - amt_cur = -amount_cur - + if cur_id: + res_currency_obj = self.pool.get('res.currency') + amt_cur = -res_currency_obj.compute(cr, uid, company_currency_id, cur_id, amount, context=context) + res = self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, - amount_currency=amt_cur, currency_id=cur_id, analytic_id = anl_id, context=context) + amount_currency=amt_cur, currency_id=cur_id, analytic_id=anl_id, context=context) return res def _get_counter_part_account(sefl, cr, uid, st_line, context=None): @@ -235,12 +232,9 @@ class account_bank_statement(osv.osv): create the move from. :return: int/long of the account.account to use as counterpart """ - account_id = False if st_line.amount >= 0: - account_id = st_line.statement_id.journal_id.default_credit_account_id.id - else: - account_id = st_line.statement_id.journal_id.default_debit_account_id.id - return account_id + return st_line.statement_id.journal_id.default_credit_account_id.id + return st_line.statement_id.journal_id.default_debit_account_id.id def _get_counter_part_partner(sefl, cr, uid, st_line, context=None): """Retrieve the partner to use in the counterpart move. @@ -251,9 +245,7 @@ class account_bank_statement(osv.osv): create the move from. :return: int/long of the res.partner to use as counterpart """ - partner_id = ((st_line.partner_id) and st_line.partner_id.id) or False - return partner_id - + return st_line.partner_id and st_line.partner_id.id or False def _prepare_counterpart_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, context=None): @@ -279,11 +271,10 @@ class account_bank_statement(osv.osv): if st_line.statement_id.currency.id <> company_currency_id: amt_cur = st_line.amount cur_id = st_line.statement_id.currency.id - res = self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, + return self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, amount_currency = amt_cur, currency_id = cur_id, account_id = account_id, partner_id = partner_id, context=context) - return res - + def _prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, credit, currency_id = False, amount_currency= False, account_id = False, analytic_id = False, partner_id = False, context=None): @@ -305,23 +296,10 @@ class account_bank_statement(osv.osv): :param int/long partner_id: ID of the partner to put on the move line :return: dict of value to create() the account.move.line """ - acc_id = (st_line.account_id) and st_line.account_id.id - cur_id = st_line.statement_id.currency.id - par_id = ((st_line.partner_id) and st_line.partner_id.id) or False - anl_acc_id = False - am_curr = False - amount_currency = False - if account_id: - acc_id = account_id - if currency_id: - cur_id = currency_id - if amount_currency: - am_curr = amount_currency - if analytic_id: - anl_acc_id = analytic_id - if partner_id: - par_id = partner_id - ml_val = { + acc_id = account_id or st_line.account_id.id + cur_id = currency_id or st_line.statement_id.currency.id + par_id = partner_id or (((st_line.partner_id) and st_line.partner_id.id) or False) + return { 'name': st_line.name, 'date': st_line.date, 'ref': st_line.ref, @@ -334,15 +312,14 @@ class account_bank_statement(osv.osv): 'journal_id': st_line.statement_id.journal_id.id, 'period_id': st_line.statement_id.period_id.id, 'currency_id': cur_id, - 'amount_currency': am_curr, - 'analytic_account_id': anl_acc_id, + 'amount_currency': amount_currency, + 'analytic_account_id': analytic_id, } - return ml_val def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): - """Create the account move from the statement line using the _prepare_bank_move_line and - _prepare_counterpart_move_line hook methods. - :param int/long st_line: ID of the account.bank.statement.line to create the move from. + """Create the account move from the statement line. + + :param int/long st_line_id: ID of the account.bank.statement.line to create the move from. :param int/long company_currency_id: ID of the res.currency of the company :param char st_line_number: will be used as the name of the generated account move :return: ID of the account.move created @@ -373,14 +350,14 @@ class account_bank_statement(osv.osv): amount = res_currency_obj.compute(cr, uid, st.currency.id, company_currency_id, st_line.amount, context=context) - bank_move_val = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount, + bank_move_vals = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount, company_currency_id, context=context) - move_line_id = account_move_line_obj.create(cr, uid, bank_move_val, context=context) + move_line_id = account_move_line_obj.create(cr, uid, bank_move_vals, context=context) torec.append(move_line_id) - counterpart_move_val = self._prepare_counterpart_move_line(cr, uid, st_line, move_id, + counterpart_move_vals = self._prepare_counterpart_move_line(cr, uid, st_line, move_id, amount, company_currency_id, context=context) - account_move_line_obj.create(cr, uid, counterpart_move_val, context=context) + account_move_line_obj.create(cr, uid, counterpart_move_vals, context=context) for line in account_move_line_obj.browse(cr, uid, [x.id for x in account_move_obj.browse(cr, uid, move_id,