콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
7379 화면

hello how to get a status and change?

The difficulty is in OpenERP 6.1 Server ubuntu 12:04 postgresql 9.1

I'm customizing the module "account_payment_extension" to better control check, created the status check (STATE_CHEQUE - "in cash", "another" and "used")

and 2 files (account_voucher.py and voucher_payment_receipt_view.xml), the changes are 90% ready.

When making the payment checks Open check if the status starts "in cash", if not status is "other" to this ok,

My doubt is the best way to change this status

STATE_CHEQUE "in cash" to "used"

file: account_voucher.py

import time from lxml import etree

import netsvc from osv import osv, fields import decimal_precision as dp from tools.translate import _

class account_voucher(osv.osv): _inherit = 'account.voucher'

_columns = {

   'move_line_id': fields.many2many('account.move.line', 'account_move_line_rel','voucher_id', 'move_line_id', 'Cheques', domain="[('state_cheque','=','caixa'), ('credit','=','0')]"),
}


def _state_cheque_get(self, cr, uid, ids, field_name, arg, context={}):        
    result = {}
    move_line_obj = self.pool.get('account.move.line')
    for rec in self.browse(cr, uid, ids, context):
        move_line_id = move_line_obj.search(cr, uid, [('state_cheque', '=', rec.state_cheque)], context=context)
        if move_line_id:
            inv = move_line_obj.browse(cr, uid, move_line_id[0], context)
            if inv.state_cheque:
                if inv.state_cheque == 'caixa':
                    self.write(cr, uid, ids, {'state_cheque': 'usado'})

            else:
                result[rec.id] = (0,0)
    return result

account_voucher()

and

file: voucher_payment_receipt_view.xml

<openerp> <data>

<record model="ir.ui.view" id="view_cheque_vendor_payment_form">
      <field name="name">cheque.form</field>
      <field name="model">account.voucher</field>
      <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
      <field name="arch" type="xml">
        <xpath expr="/form/notebook/page/field[@name='line_dr_ids']" position="after">
          <group col="2" colspan="4">
           <separator string="Cheques Enviado" colspan="4"/>    
            <field name="move_line_id" widget="many2many" nolabel="1">
            <tree>
            <field name="partner_id" string="Cliente"/>
            <field name="partner_bank_id" string="Banco"/>
            <field name="numero_cheque"/>
            <field name="partner_id_emitente"/>
            <field name="debit" string="Valor" sum="debit"/>
            <field name="partner_bank_id_emitente"/>
            <field name="state_cheque"/>
            </tree>
          </field>
          </group>
        </xpath>
     </field>
 </record>

</data> </openerp>

tks Jair

아바타
취소
관련 게시물 답글 화면 활동
5
12월 24
33447
1
4월 21
2324
0
3월 15
4000
2
9월 25
141
3
8월 25
483