OLD | NEW |
(Empty) | |
| 1 #This file is part of Tryton. The COPYRIGHT file at the top level of |
| 2 #this repository contains the full copyright notices and license terms. |
| 3 from trytond.model import ModelView, ModelSQL, fields |
| 4 from trytond.pyson import Not, Eval, Bool, Or, In |
| 5 |
| 6 |
| 7 class Category(ModelSQL, ModelView): |
| 8 _name = 'product.category' |
| 9 |
| 10 account_stock = fields.Property(fields.Many2One('account.account', |
| 11 'Account Stock', domain=[ |
| 12 ('kind', '!=', 'view'), |
| 13 ('company', '=', Eval('company')), |
| 14 ], |
| 15 states={ |
| 16 'invisible': Not(Bool(Eval('company'))), |
| 17 })) |
| 18 account_stock_input = fields.Property(fields.Many2One('account.account', |
| 19 'Account Stock Input', domain=[ |
| 20 ('kind', '!=', 'view'), |
| 21 ('company', '=', Eval('company')), |
| 22 ], |
| 23 states={ |
| 24 'invisible': Not(Bool(Eval('company'))), |
| 25 })) |
| 26 account_stock_output = fields.Property(fields.Many2One('account.account', |
| 27 'Account Stock Output', domain=[ |
| 28 ('kind', '!=', 'view'), |
| 29 ('company', '=', Eval('company')), |
| 30 ], |
| 31 states={ |
| 32 'invisible': Not(Bool(Eval('company'))), |
| 33 })) |
| 34 account_journal_stock_input = fields.Property(fields.Many2One( |
| 35 'account.journal', 'Account Journal Stock Input', |
| 36 states={ |
| 37 'invisible': Not(Bool(Eval('company'))), |
| 38 })) |
| 39 account_journal_stock_output = fields.Property(fields.Many2One( |
| 40 'account.journal', 'Account Journal Stock Output', |
| 41 states={ |
| 42 'invisible': Not(Bool(Eval('company'))), |
| 43 })) |
| 44 |
| 45 Category() |
| 46 |
| 47 |
| 48 class Template(ModelSQL, ModelView): |
| 49 _name = 'product.template' |
| 50 |
| 51 account_stock = fields.Property(fields.Many2One('account.account', |
| 52 'Account Stock', domain=[ |
| 53 ('kind', '!=', 'view'), |
| 54 ('company', '=', Eval('company')), |
| 55 ], |
| 56 states={ |
| 57 'invisible': Or(Not(Bool(Eval('company'))), |
| 58 Bool(Eval('account_category'))), |
| 59 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 60 }, help='This account will be used instead of the one defined ' |
| 61 'on the category.', depends=['account_category'])) |
| 62 account_stock_input = fields.Property(fields.Many2One('account.account', |
| 63 'Account Stock Input', domain=[ |
| 64 ('kind', '!=', 'view'), |
| 65 ('company', '=', Eval('company')), |
| 66 ], |
| 67 states={ |
| 68 'invisible': Or(Not(Bool(Eval('company'))), |
| 69 Bool(Eval('account_category'))), |
| 70 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 71 }, help='This account will be used instead of the one defined ' |
| 72 'on the category.', depends=['account_category'])) |
| 73 account_stock_output = fields.Property(fields.Many2One('account.account', |
| 74 'Account Stock Output', domain=[ |
| 75 ('kind', '!=', 'view'), |
| 76 ('company', '=', Eval('company')), |
| 77 ], |
| 78 states={ |
| 79 'invisible': Or(Not(Bool(Eval('company'))), |
| 80 Bool(Eval('account_category'))), |
| 81 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 82 }, help='This account will be used instead of the one defined ' |
| 83 'on the category.', depends=['account_category'])) |
| 84 account_journal_stock_input = fields.Property(fields.Many2One( |
| 85 'account.journal', 'Account Journal Stock Input', |
| 86 states={ |
| 87 'invisible': Or(Not(Bool(Eval('company'))), |
| 88 Bool(Eval('account_category'))), |
| 89 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 90 }, help='This account will be used instead of the one defined ' |
| 91 'on the category.', depends=['account_category'])) |
| 92 account_journal_stock_output = fields.Property(fields.Many2One( |
| 93 'account.journal', 'Account Journal Stock Output', |
| 94 states={ |
| 95 'invisible': Or(Not(Bool(Eval('company'))), |
| 96 Bool(Eval('account_category'))), |
| 97 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 98 }, help='This account will be used instead of the one defined ' |
| 99 'on the category.', depends=['account_category'])) |
| 100 account_stock_used = fields.Function(fields.Many2One('account.account', |
| 101 'Account Stock Used'), 'get_account') |
| 102 account_stock_input_used = fields.Function(fields.Many2One( |
| 103 'account.account', 'Account Stock Input Used'), 'get_account') |
| 104 account_stock_output_used = fields.Function(fields.Many2One( |
| 105 'account.account', 'Account Stock Output Used'), 'get_account') |
| 106 account_journal_stock_input_used = fields.Function(fields.Many2One( |
| 107 'account.journal', 'Account Journal Stock Input'), 'get_account') |
| 108 account_journal_stock_output_used = fields.Function(fields.Many2One( |
| 109 'account.journal', 'Account Journal Stock Output'), 'get_account') |
| 110 |
| 111 Template() |
| 112 |
OLD | NEW |