line: felder löschen bei änderung von bookingtype
This commit is contained in:
parent
7999440de7
commit
3db6822f26
3 changed files with 23 additions and 5 deletions
10
line.py
10
line.py
|
@ -527,12 +527,18 @@ class Line(Workflow, ModelSQL, ModelView):
|
||||||
if not self.bookingtype in types.get(self.category.cattype, ''):
|
if not self.bookingtype in types.get(self.category.cattype, ''):
|
||||||
self.category = None
|
self.category = None
|
||||||
|
|
||||||
if self.bookingtype in ['spin', 'spout']:
|
if self.bookingtype.startswith('sp'): # split booking
|
||||||
|
self.category = None
|
||||||
|
self.booktransf = None
|
||||||
for spline in self.splitlines:
|
for spline in self.splitlines:
|
||||||
if not self.bookingtype in types.get(getattr(spline.category, 'cattype', '-'), ''):
|
if not self.bookingtype in types.get(getattr(spline.category, 'cattype', '-'), ''):
|
||||||
spline.category = None
|
spline.category = None
|
||||||
else :
|
elif self.bookingtype.startswith('mv'): # transfer
|
||||||
self.splitlines = []
|
self.splitlines = []
|
||||||
|
self.category = None
|
||||||
|
else : # category
|
||||||
|
self.splitlines = []
|
||||||
|
self.booktransf = None
|
||||||
|
|
||||||
@fields.depends('description')
|
@fields.depends('description')
|
||||||
def on_change_with_descr_short(self, name=None):
|
def on_change_with_descr_short(self, name=None):
|
||||||
|
|
10
splitline.py
10
splitline.py
|
@ -67,6 +67,8 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
amount = fields.Numeric(string='Amount', digits=(16, Eval('currency_digits', 2)),
|
amount = fields.Numeric(string='Amount', digits=(16, Eval('currency_digits', 2)),
|
||||||
required=True, states=STATES, depends=DEPENDS+['currency_digits'])
|
required=True, states=STATES, depends=DEPENDS+['currency_digits'])
|
||||||
|
|
||||||
|
date = fields.Function(fields.Date(string='Date', readonly=True),
|
||||||
|
'on_change_with_date')
|
||||||
target = fields.Function(fields.Reference(string='Target', readonly=True,
|
target = fields.Function(fields.Reference(string='Target', readonly=True,
|
||||||
selection=sel_target), 'on_change_with_target')
|
selection=sel_target), 'on_change_with_target')
|
||||||
currency = fields.Function(fields.Many2One(model_name='currency.currency',
|
currency = fields.Function(fields.Many2One(model_name='currency.currency',
|
||||||
|
@ -134,6 +136,14 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
if self.splittype == 'tr':
|
if self.splittype == 'tr':
|
||||||
self.category = None
|
self.category = None
|
||||||
|
|
||||||
|
@fields.depends('line', '_parent_line.date')
|
||||||
|
def on_change_with_date(self, name=None):
|
||||||
|
""" get date of line
|
||||||
|
"""
|
||||||
|
if self.line:
|
||||||
|
if self.line.date is not None:
|
||||||
|
return self.line.date
|
||||||
|
|
||||||
@fields.depends('splittype', 'category', 'booktransf')
|
@fields.depends('splittype', 'category', 'booktransf')
|
||||||
def on_change_with_target(self, name=None):
|
def on_change_with_target(self, name=None):
|
||||||
""" get category or cashbook
|
""" get category or cashbook
|
||||||
|
|
|
@ -17,7 +17,9 @@ full copyright notices and license terms. -->
|
||||||
<label name="booktransf"/>
|
<label name="booktransf"/>
|
||||||
<field name="booktransf" colspan="3"/>
|
<field name="booktransf" colspan="3"/>
|
||||||
|
|
||||||
<group name="description" colspan="4" col="1" string="Description" yexpand="1">
|
<notebook colspan="4">
|
||||||
<field name="description" yfill="1"/>
|
<page name="description" col="1" string="Description">
|
||||||
</group>
|
<field name="description"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue