LEFT | RIGHT |
1 #This file is part of Tryton. The COPYRIGHT file at the top level of | 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. | 2 #this repository contains the full copyright notices and license terms. |
3 from trytond.model import ModelView, ModelSQL, fields | 3 from trytond.model import ModelView, ModelSQL, fields |
4 from trytond.pyson import Not, Eval, Bool, Or, In | 4 from trytond.pyson import Not, Eval, Bool, Or, In |
5 | 5 |
6 | 6 |
7 class Category(ModelSQL, ModelView): | 7 class Category(ModelSQL, ModelView): |
8 _name = 'product.category' | 8 _name = 'product.category' |
9 | 9 |
10 account_stock = fields.Property(fields.Many2One('account.account', | 10 account_stock = fields.Property(fields.Many2One('account.account', |
11 'Account Stock', domain=[ | 11 'Account Stock', domain=[ |
12 ('kind', '!=', 'view'), | 12 ('kind', '!=', 'view'), |
13 ('company', '=', Eval('company')), | 13 ('company', '=', Eval('company')), |
14 ], | 14 ], states={ |
| 15 'invisible': Not(Bool(Eval('company'))), |
| 16 })) |
| 17 account_stock_supplier = fields.Property(fields.Many2One('account.account', |
| 18 'Account Stock Supplier', domain=[ |
| 19 ('kind', '!=', 'view'), |
| 20 ('company', '=', Eval('company')), |
| 21 ], states={ |
| 22 'invisible': Not(Bool(Eval('company'))), |
| 23 })) |
| 24 account_stock_customer = fields.Property(fields.Many2One('account.account', |
| 25 'Account Stock Customer', domain=[ |
| 26 ('kind', '!=', 'view'), |
| 27 ('company', '=', Eval('company')), |
| 28 ], states={ |
| 29 'invisible': Not(Bool(Eval('company'))), |
| 30 })) |
| 31 account_stock_lost_found = fields.Property(fields.Many2One( |
| 32 'account.account', 'Account Stock Lost and Found', domain=[ |
| 33 ('kind', '!=', 'view'), |
| 34 ('company', '=', Eval('company')), |
| 35 ], states={ |
| 36 'invisible': Not(Bool(Eval('company'))), |
| 37 })) |
| 38 account_journal_stock_supplier = fields.Property(fields.Many2One( |
| 39 'account.journal', 'Journal Stock Supplier', |
15 states={ | 40 states={ |
16 'invisible': Not(Bool(Eval('company'))), | 41 'invisible': Not(Bool(Eval('company'))), |
17 })) | 42 })) |
18 account_stock_input = fields.Property(fields.Many2One('account.account', | 43 account_journal_stock_customer = fields.Property(fields.Many2One( |
19 'Account Stock Input', domain=[ | 44 'account.journal', 'Journal Stock Customer', |
20 ('kind', '!=', 'view'), | |
21 ('company', '=', Eval('company')), | |
22 ], | |
23 states={ | 45 states={ |
24 'invisible': Not(Bool(Eval('company'))), | 46 'invisible': Not(Bool(Eval('company'))), |
25 })) | 47 })) |
26 account_stock_output = fields.Property(fields.Many2One('account.account', | 48 account_journal_stock_lost_found = fields.Property(fields.Many2One( |
27 'Account Stock Output', domain=[ | 49 'account.journal', 'Journal Stock Lost and Found', |
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={ | 50 states={ |
42 'invisible': Not(Bool(Eval('company'))), | 51 'invisible': Not(Bool(Eval('company'))), |
43 })) | 52 })) |
44 | 53 |
45 Category() | 54 Category() |
46 | 55 |
47 | 56 |
48 class Template(ModelSQL, ModelView): | 57 class Template(ModelSQL, ModelView): |
49 _name = 'product.template' | 58 _name = 'product.template' |
50 | 59 |
51 account_stock = fields.Property(fields.Many2One('account.account', | 60 account_stock = fields.Property(fields.Many2One('account.account', |
52 'Account Stock', domain=[ | 61 'Account Stock', domain=[ |
53 ('kind', '!=', 'view'), | 62 ('kind', '!=', 'view'), |
54 ('company', '=', Eval('company')), | 63 ('company', '=', Eval('company')), |
55 ], | 64 ], states={ |
56 states={ | |
57 'invisible': Or(Not(Bool(Eval('company'))), | 65 'invisible': Or(Not(Bool(Eval('company'))), |
58 Bool(Eval('account_category'))), | 66 Bool(Eval('account_category'))), |
59 'required': In(Eval('type'), ['stockable', 'consumable']), | 67 'required': In(Eval('type'), ['stockable', 'consumable']), |
60 }, help='This account will be used instead of the one defined ' | 68 }, help='This account will be used instead of the one defined ' |
61 'on the category.', depends=['account_category'])) | 69 'on the category.', depends=['account_category'])) |
62 account_stock_input = fields.Property(fields.Many2One('account.account', | 70 account_stock_supplier = fields.Property(fields.Many2One('account.account', |
63 'Account Stock Input', domain=[ | 71 'Account Stock Supplier', domain=[ |
64 ('kind', '!=', 'view'), | 72 ('kind', '!=', 'view'), |
65 ('company', '=', Eval('company')), | 73 ('company', '=', Eval('company')), |
66 ], | 74 ], states={ |
67 states={ | |
68 'invisible': Or(Not(Bool(Eval('company'))), | 75 'invisible': Or(Not(Bool(Eval('company'))), |
69 Bool(Eval('account_category'))), | 76 Bool(Eval('account_category'))), |
70 'required': In(Eval('type'), ['stockable', 'consumable']), | 77 'required': In(Eval('type'), ['stockable', 'consumable']), |
71 }, help='This account will be used instead of the one defined ' | 78 }, help='This account will be used instead of the one defined ' |
72 'on the category.', depends=['account_category'])) | 79 'on the category.', depends=['account_category'])) |
73 account_stock_output = fields.Property(fields.Many2One('account.account', | 80 account_stock_customer = fields.Property(fields.Many2One('account.account', |
74 'Account Stock Output', domain=[ | 81 'Account Stock Customer', domain=[ |
75 ('kind', '!=', 'view'), | 82 ('kind', '!=', 'view'), |
76 ('company', '=', Eval('company')), | 83 ('company', '=', Eval('company')), |
77 ], | 84 ], states={ |
78 states={ | |
79 'invisible': Or(Not(Bool(Eval('company'))), | 85 'invisible': Or(Not(Bool(Eval('company'))), |
80 Bool(Eval('account_category'))), | 86 Bool(Eval('account_category'))), |
81 'required': In(Eval('type'), ['stockable', 'consumable']), | 87 'required': In(Eval('type'), ['stockable', 'consumable']), |
82 }, help='This account will be used instead of the one defined ' | 88 }, help='This account will be used instead of the one defined ' |
83 'on the category.', depends=['account_category'])) | 89 'on the category.', depends=['account_category'])) |
84 account_journal_stock_input = fields.Property(fields.Many2One( | 90 account_stock_lost_found = fields.Property(fields.Many2One( |
85 'account.journal', 'Account Journal Stock Input', | 91 'account.account', 'Account Stock Lost and Found', domain=[ |
86 states={ | 92 ('kind', '!=', 'view'), |
| 93 ('company', '=', Eval('company')), |
| 94 ], states={ |
87 'invisible': Or(Not(Bool(Eval('company'))), | 95 'invisible': Or(Not(Bool(Eval('company'))), |
88 Bool(Eval('account_category'))), | 96 Bool(Eval('account_category'))), |
89 'required': In(Eval('type'), ['stockable', 'consumable']), | 97 'required': In(Eval('type'), ['stockable', 'consumable']), |
90 }, help='This account will be used instead of the one defined ' | 98 }, help='This account will be used instead of the one defined ' |
91 'on the category.', depends=['account_category'])) | 99 'on the category.', depends=['account_category'])) |
92 account_journal_stock_output = fields.Property(fields.Many2One( | 100 account_journal_stock_supplier = fields.Property(fields.Many2One( |
93 'account.journal', 'Account Journal Stock Output', | 101 'account.journal', 'Account Journal Stock Supplier', |
94 states={ | 102 states={ |
95 'invisible': Or(Not(Bool(Eval('company'))), | 103 'invisible': Or(Not(Bool(Eval('company'))), |
96 Bool(Eval('account_category'))), | 104 Bool(Eval('account_category'))), |
97 'required': In(Eval('type'), ['stockable', 'consumable']), | 105 'required': In(Eval('type'), ['stockable', 'consumable']), |
98 }, help='This account will be used instead of the one defined ' | 106 }, help='This journal will be used instead of the one defined ' |
| 107 'on the category.', depends=['account_category'])) |
| 108 account_journal_stock_customer = fields.Property(fields.Many2One( |
| 109 'account.journal', 'Account Journal Stock Customer', |
| 110 states={ |
| 111 'invisible': Or(Not(Bool(Eval('company'))), |
| 112 Bool(Eval('account_category'))), |
| 113 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 114 }, help='This journal will be used instead of the one defined ' |
| 115 'on the category.', depends=['account_category'])) |
| 116 account_journal_stock_lost_found = fields.Property(fields.Many2One( |
| 117 'account.journal', 'Account Journal Stock Lost and Found', |
| 118 states={ |
| 119 'invisible': Or(Not(Bool(Eval('company'))), |
| 120 Bool(Eval('account_category'))), |
| 121 'required': In(Eval('type'), ['stockable', 'consumable']), |
| 122 }, help='This journal will be used instead of the one defined ' |
99 'on the category.', depends=['account_category'])) | 123 'on the category.', depends=['account_category'])) |
100 account_stock_used = fields.Function(fields.Many2One('account.account', | 124 account_stock_used = fields.Function(fields.Many2One('account.account', |
101 'Account Stock Used'), 'get_account') | 125 'Account Stock Used'), 'get_account') |
102 account_stock_input_used = fields.Function(fields.Many2One( | 126 account_stock_supplier_used = fields.Function(fields.Many2One( |
103 'account.account', 'Account Stock Input Used'), 'get_account') | 127 'account.account', 'Account Stock Supplier Used'), 'get_account') |
104 account_stock_output_used = fields.Function(fields.Many2One( | 128 account_stock_customer_used = fields.Function(fields.Many2One( |
105 'account.account', 'Account Stock Output Used'), 'get_account') | 129 'account.account', 'Account Stock Customer Used'), 'get_account') |
106 account_journal_stock_input_used = fields.Function(fields.Many2One( | 130 account_stock_lost_found_used = fields.Function(fields.Many2One( |
107 'account.journal', 'Account Journal Stock Input'), 'get_account') | 131 'account.account', 'Account Stock Lost and Found'), 'get_account') |
108 account_journal_stock_output_used = fields.Function(fields.Many2One( | 132 account_journal_stock_supplier_used = fields.Function(fields.Many2One( |
109 'account.journal', 'Account Journal Stock Output'), 'get_account') | 133 'account.journal', 'Journal Stock Supplier'), 'get_account') |
| 134 account_journal_stock_customer_used = fields.Function(fields.Many2One( |
| 135 'account.journal', 'Journal Stock Customer'), 'get_account') |
| 136 account_journal_stock_lost_found_used = fields.Function(fields.Many2One( |
| 137 'account.journal', 'Journal Stock Lost and Found'), |
| 138 'get_account') |
110 | 139 |
111 Template() | 140 Template() |
112 | 141 |
LEFT | RIGHT |