diff --git a/line.py b/line.py index db402e9..12e89b0 100644 --- a/line.py +++ b/line.py @@ -527,12 +527,18 @@ class Line(Workflow, ModelSQL, ModelView): if not self.bookingtype in types.get(self.category.cattype, ''): 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: if not self.bookingtype in types.get(getattr(spline.category, 'cattype', '-'), ''): spline.category = None - else : + elif self.bookingtype.startswith('mv'): # transfer self.splitlines = [] + self.category = None + else : # category + self.splitlines = [] + self.booktransf = None @fields.depends('description') def on_change_with_descr_short(self, name=None): diff --git a/splitline.py b/splitline.py index f956b82..dc8ba43 100644 --- a/splitline.py +++ b/splitline.py @@ -67,6 +67,8 @@ class SplitLine(ModelSQL, ModelView): amount = fields.Numeric(string='Amount', digits=(16, Eval('currency_digits', 2)), 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, selection=sel_target), 'on_change_with_target') currency = fields.Function(fields.Many2One(model_name='currency.currency', @@ -134,6 +136,14 @@ class SplitLine(ModelSQL, ModelView): if self.splittype == 'tr': 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') def on_change_with_target(self, name=None): """ get category or cashbook diff --git a/view/split_form.xml b/view/split_form.xml index dd0924f..71ed265 100644 --- a/view/split_form.xml +++ b/view/split_form.xml @@ -17,7 +17,9 @@ full copyright notices and license terms. -->