Add domains in journal field. Add shops field in journal model and view
This commit is contained in:
parent
b577ad4eb6
commit
d610f589b7
|
@ -3,10 +3,13 @@
|
|||
# copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from .shop import *
|
||||
from .journal import *
|
||||
from .sale import *
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
Journal,
|
||||
SaleShop,
|
||||
Sale,
|
||||
module='sale_shop_invoice_journal', type_='model')
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# This file is part of sale_shop_invoice_journal module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['Journal']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class Journal:
|
||||
__name__ = 'account.journal'
|
||||
shops = fields.One2Many('sale.shop', 'journal', 'Shops',
|
||||
states={
|
||||
'invisible': Eval('type') != 'revenue',
|
||||
}, depends=['type'])
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of sale_shop_invoice_journal module for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<!-- account.journal -->
|
||||
<record model="ir.ui.view" id="journal_view_form">
|
||||
<field name="model">account.journal</field>
|
||||
<field name="inherit" ref="account.journal_view_form"/>
|
||||
<field name="name">journal_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
3
sale.py
3
sale.py
|
@ -10,7 +10,8 @@ __metaclass__ = PoolMeta
|
|||
|
||||
class Sale:
|
||||
__name__ = 'sale.sale'
|
||||
journal = fields.Many2One('account.journal', 'Account Journal')
|
||||
journal = fields.Many2One('account.journal', 'Account Journal',
|
||||
domain=[('type', '=', 'revenue')])
|
||||
|
||||
def _get_invoice_sale(self, invoice_type):
|
||||
invoice = super(Sale, self)._get_invoice_sale(invoice_type)
|
||||
|
|
3
shop.py
3
shop.py
|
@ -10,4 +10,5 @@ __metaclass__ = PoolMeta
|
|||
|
||||
class SaleShop:
|
||||
__name__ = 'sale.shop'
|
||||
journal = fields.Many2One('account.journal', 'Account Journal')
|
||||
journal = fields.Many2One('account.journal', 'Account Journal',
|
||||
domain=[('type', '=', 'revenue')])
|
||||
|
|
|
@ -7,4 +7,5 @@ depends:
|
|||
account_invoice_multisequence
|
||||
xml:
|
||||
shop.xml
|
||||
journal.xml
|
||||
sale.xml
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of the sale_shop_invoice_journal module for Tryton.
|
||||
The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='sequences']" position="after">
|
||||
<page string="Shops"
|
||||
states="{'invisible': Eval('type') != 'revenue'}"
|
||||
id="shops">
|
||||
<field name="shops" colspan="4" widget="many2many"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue