From e2d3d617a96e416751c15e42d3fbebedfdc7e00c Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Oct 2012 12:49:52 +0200 Subject: [PATCH 1/7] [IMP] account: added monetary widget on invoices form view bzr revid: qdp-launchpad@openerp.com-20121010104952-jxy17zagby2jp0w2 --- addons/account/account_invoice_view.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 8421409d4ce..8516fcd96ae 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -211,17 +211,17 @@ - +
- - + + - +
@@ -368,16 +368,16 @@ - +
- - - + + +
From 7c6e893a3952b206ba6f8e6301336ceced1b3f38 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Oct 2012 12:56:19 +0200 Subject: [PATCH 2/7] [IMP] account: added monetary widget on account.move.line and cash registers bzr revid: qdp-launchpad@openerp.com-20121010105619-fk13ba9ex0f0ihpv --- addons/account/account_view.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3391158696a..d98b53ebbbd 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1127,8 +1127,8 @@ - - + + @@ -1174,8 +1174,8 @@ - - + + @@ -2564,7 +2564,7 @@ action = pool.get('res.config').next(cr, uid, [], context) - + @@ -2626,12 +2626,12 @@ action = pool.get('res.config').next(cr, uid, [], context) - - - + + + - + From 1bb568d22e4fa493f3fa388928f47af09e24d90a Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Oct 2012 13:12:05 +0200 Subject: [PATCH 3/7] [IMP] sale, sale_margin: added monetary widget on sale order form view bzr revid: qdp-launchpad@openerp.com-20121010111205-eokyh1haa69tgrfl --- addons/sale/sale.py | 10 ++++++++-- addons/sale/sale_view.xml | 7 ++++--- addons/sale_margin/sale_margin_view.xml | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index ed7a2835425..9ba6c43a588 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -201,6 +201,7 @@ class sale_order(osv.osv): help="""This field controls how invoice and delivery operations are synchronized. - With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""), 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Pricelist for current sales order."), + 'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", readonly=True, required=True), 'project_id': fields.many2one('account.analytic.account', 'Contract/Analytic Account', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="The analytic account related to a sales order."), 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), @@ -264,13 +265,18 @@ class sale_order(osv.osv): return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None): - if (not pricelist_id) or (not order_lines): + if not pricelist_id: return {} + value = { + 'currency_id': self.pool.get('product.pricelist').browse(cr, uid, pricelist_id, context=context).currency_id.id + } + if not order_lines: + return {'value': value} warning = { 'title': _('Pricelist Warning!'), 'message' : _('If you change the pricelist of this order (and eventually the currency), prices of existing order lines will not be updated.') } - return {'warning': warning} + return {'warning': warning, 'value': value} def onchange_partner_id(self, cr, uid, ids, part): if not part: diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index a9ebca876a9..8b89e8047cb 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -184,6 +184,7 @@ + @@ -261,14 +262,14 @@ - - + + - + diff --git a/addons/sale_margin/sale_margin_view.xml b/addons/sale_margin/sale_margin_view.xml index 69f49bd48ea..6aa34bae26c 100644 --- a/addons/sale_margin/sale_margin_view.xml +++ b/addons/sale_margin/sale_margin_view.xml @@ -11,7 +11,7 @@ From 155680a15871af3f06abaa461c7e531c1f2adc8d Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Oct 2012 13:20:13 +0200 Subject: [PATCH 4/7] [IMP] purchase: added monetary widget on purchase order form view bzr revid: qdp-launchpad@openerp.com-20121010112013-d6z1iq6hpjgdle63 --- addons/purchase/purchase.py | 6 ++++++ addons/purchase/purchase_view.xml | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index d654078a055..c0516d09de3 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -166,6 +166,7 @@ class purchase_order(osv.osv): 'warehouse_id': fields.many2one('stock.warehouse', 'Destination Warehouse', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}), 'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')]), 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."), + 'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", readonly=True, required=True), 'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True), 'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'approved':[('readonly',True)],'done':[('readonly',True)]}), 'validator' : fields.many2one('res.users', 'Validated by', readonly=True), @@ -246,6 +247,11 @@ class purchase_order(osv.osv): def button_dummy(self, cr, uid, ids, context=None): return True + def onchange_pricelist(self, cr, uid, ids, pricelist_id, context=None): + if not pricelist_id: + return {} + return {'value': {'currency_id': self.pool.get('product.pricelist').browse(cr, uid, pricelist_id, context=context).currency_id.id}} + def onchange_dest_address_id(self, cr, uid, ids, address_id): if not address_id: return {} diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index bfff06f5eaf..446c17578cb 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -223,7 +223,8 @@ - + + @@ -249,14 +250,14 @@ - - + + - +
- +
From 7162a6255041642117c8e164eba59c7658ec9d73 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 10 Oct 2012 14:52:31 +0200 Subject: [PATCH 7/7] [IMP] account_asset: added monetary widget on asset form view bzr revid: qdp-launchpad@openerp.com-20121010125231-q3pmc65m5ujz2anr --- addons/account_asset/account_asset_view.xml | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/account_asset/account_asset_view.xml b/addons/account_asset/account_asset_view.xml index 3fab306863c..520ee733e73 100644 --- a/addons/account_asset/account_asset_view.xml +++ b/addons/account_asset/account_asset_view.xml @@ -106,27 +106,27 @@ - - - - - + + + + + - - - - + + + + - + + + + + +