2017-08-31 7 views

答えて

6

は間違いミケーレZaccedduあなたは特に、account_idなどの重要な分野のために、モデルをオーバーライドし、そのようrequiredreadonlyとしてそのフィールドのプロパティを更新する必要があります正しい答えを持って同意します。

ただし、絶対に必要なシナリオが発生した場合は、フィールドをすべて削除することもできます。あなたは、削除しようとしているフィールドにxmlビューとpythonメソッド内のすべての参照を削除することを確実にしたいでしょう。

<record> 
    ... 

    <field name="arch" type="xml"> 
     <field name="account_id" position="replace"/> 
    </field> 
</record> 
class Invoice(models.Model): 
    _inherit = 'account.invoice' 

    def _method(self): 
     # override methods that reference or use the fields we 
     # are about to delete so that we don't break core 

delattr(odoo.addons.account.models.account_invoice.AccountInvoice, 'account_id') 
4

あなたは、フィールドを削除することはできません。必要なプロパティは削除できますが、フィールド自体は削除できません。 これを行うには、account.invoiceモデルを継承し、そのフィールドを再定義する必要があります。

同様:

class AccountInherit(models.Model): 
    _inherit = 'account.invoice' 

    < here define that field, it must be the same as the original but the required property > 
関連する問題