diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 7e99762a5ac..eb196fa6a8e 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -197,6 +197,7 @@ + @@ -283,6 +284,7 @@ + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index e0854cf3eae..a560b094b40 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -270,6 +270,7 @@ class account_invoice(osv.osv): help="Remaining amount due."), 'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'), 'move_name': fields.char('Account Move', size=64), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position') } _defaults = { 'type': _get_type, @@ -305,6 +306,7 @@ class account_invoice(osv.osv): partner_payment_term = False acc_id = False bank_id = False + fiscal_position = False opt = [('uid', str(uid))] if partner_id: @@ -318,7 +320,8 @@ class account_invoice(osv.osv): acc_id = p.property_account_receivable.id else: acc_id = p.property_account_payable.id - + if p.property_account_position: + fiscal_position = p.property_account_position.id partner_payment_term = p.property_payment_term and p.property_payment_term.id or False if p.bank_ids: bank_id = p.bank_ids[0].id @@ -328,6 +331,7 @@ class account_invoice(osv.osv): 'address_invoice_id': invoice_addr_id, 'account_id': acc_id, 'payment_term': partner_payment_term, + 'fiscal_position': fiscal_position } } diff --git a/addons/account_payment/payment.py b/addons/account_payment/payment.py index 0137ad9e9cf..08f5615242e 100644 --- a/addons/account_payment/payment.py +++ b/addons/account_payment/payment.py @@ -93,9 +93,9 @@ class payment_order(osv.osv): return res _columns = { - 'date_planned': fields.date('Scheduled date if fixed',help='Select a date if you have chosen Preferred Date to be fixed.'), - 'reference': fields.char('Reference',size=128,required=1), - 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1,help='Select the Payment Mode to be applied.'), + 'date_planned': fields.date('Scheduled date if fixed', states={'done':[('readonly',True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'), + 'reference': fields.char('Reference', size=128, required=1, states={'done':[('readonly',True)]}), + 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1, states={'done':[('readonly',True)]}, help='Select the Payment Mode to be applied.'), 'state': fields.selection([ ('draft', 'Draft'), ('open','Confirmed'), @@ -104,12 +104,12 @@ class payment_order(osv.osv): 'line_ids': fields.one2many('payment.line','order_id','Payment lines',states={'done':[('readonly',True)]}), 'total': fields.function(_total, string="Total", method=True, type='float'), - 'user_id': fields.many2one('res.users','User',required=True), + 'user_id': fields.many2one('res.users','User', required=True, states={'done':[('readonly',True)]}), 'date_prefered': fields.selection([ ('now', 'Directly'), ('due', 'Due date'), ('fixed', 'Fixed date') - ], "Preferred date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), + ], "Preferred date", change_default=True, required=True, states={'done':[('readonly',True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), 'date_created': fields.date('Creation date', readonly=True), 'date_done': fields.date('Execution date', readonly=True), } diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/payment_view.xml index 4f476339b49..36009a105bd 100644 --- a/addons/account_payment/payment_view.xml +++ b/addons/account_payment/payment_view.xml @@ -96,7 +96,7 @@ -