This repository was archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaccount.py
More file actions
48 lines (36 loc) · 1.47 KB
/
account.py
File metadata and controls
48 lines (36 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, ValueMixin, fields
from trytond.pool import Pool, PoolMeta
stock_journal = fields.Many2One(
'account.journal', "Stock Journal", required=True)
class Configuration(metaclass=PoolMeta):
__name__ = 'account.configuration'
stock_journal = fields.MultiValue(stock_journal)
@classmethod
def default_stock_journal(cls, **pattern):
return cls.multivalue_model('stock_journal').default_stock_journal()
class ConfigurationStockJournal(ModelSQL, ValueMixin):
"Account Configuration Stock Journal"
__name__ = 'account.configuration.stock_journal'
stock_journal = stock_journal
@classmethod
def default_stock_journal(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
try:
return ModelData.get_id('account', 'journal_stock')
except KeyError:
return None
class FiscalYear(metaclass=PoolMeta):
__name__ = 'account.fiscalyear'
account_stock_method = fields.Selection([
(None, 'None'),
('continental', 'Continental'),
], 'Account Stock Method')
class AccountMove(metaclass=PoolMeta):
__name__ = 'account.move'
@classmethod
def _get_origin(cls):
return super(AccountMove, cls)._get_origin() + ['stock.move',
'product.product', 'product.template']