コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4429 ビュー

Hello Everyone,

I am customising in purchase order workflow.

i have added three new states in existing states.

i am done with everything but there is "READONLY_STATES" dictionary is declared for make fields readonly in particular states.

READONLY_STATES = {
'purchase': [('readonly', True)],
'done': [('readonly', True)],
'cancel': [('readonly', True)],

for that i write following code.

class PurchaseOrder(models.Model):
        _inherit = "purchase.order"
         READONLY_STATES = {
                    'open': [('readonly', True)],
                    'partial received': [('readonly', True)],
                    'received': [('readonly', True)],
                    'purchase': [('readonly', True)],
                    'done': [('readonly', True)],
                    'cancel': [('readonly', True)],
             }

but its not work.

I tried inherit it by importing class also but that is also not work.

アバター
破棄

I do want to know the answer of this as well. import purchase.py and re-assign READONLY_STATES doesn't help.

最善の回答

Example:

class BlanketOrder(models.Model):
_inherit = ['sale\.blanket\.order'\]

\ \ \ \ READONLY_STATES\ =\ \{
\ \ \ \ \ \ \ \ 'draft':\ \[\('readonly',\ False\)\],
\ \ \ \ \ \ \ \ 'sent':\ \[\('readonly',\ False\)\],
\ \ \ \ \ \ \ \ 'open':\ \[\('readonly',\ False\)\],
\ \ \ \ \ \ \ \ 'done':\ \[\('readonly',\ True\)\],
\ \ \ \ \ \ \ \ 'expired':\ \[\('readonly',\ True\)\],
\ \ \ \ \ \ \ \ 'cancel':\ \[\('readonly',\ True\)\],
\ \ \ \ \}

\ \ \ \ partner_id\ =\ fields\.Many2one\(states=READONLY_STATES\)
\ \ \ \ company_id\ =\ fields\.Many2one\(states=READONLY_STATES\)

Refer\ this\ module:

https://apps.odoo.com/apps/modules/14.0/sale_blanket_order_readonly_states_extended/


アバター
破棄
関連投稿 返信 ビュー 活動
1
1月 17
2556
0
5月 16
3091
0
4月 16
3283
1
7月 23
2227
3
11月 18
4523