make fileds depending of state of source document: issue11294
This commit is contained in:
parent
009c3c149f
commit
37bc923f91
|
@ -0,0 +1,85 @@
|
|||
# HG changeset patch
|
||||
# User Àngel Àlvarez <angel@nan-tic.com>
|
||||
# Make the analytic account entries read-only depending on the state of the source docume…
|
||||
|
||||
# issue11294
|
||||
|
||||
# tryton-env: Make the analytic account entries read-only depending on the state of the source docume…
|
||||
# review398021002
|
||||
|
||||
Index: 6.0/trytond/trytond/modules/analytic_account/account.py
|
||||
===================================================================
|
||||
--- 6.0.orig/trytond/trytond/modules/analytic_account/account.py
|
||||
+++ 6.0/trytond/trytond/modules/analytic_account/account.py
|
||||
@@ -437,6 +437,9 @@ class AnalyticAccountEntry(ModelView, Mo
|
||||
def _get_origin(cls):
|
||||
return ['analytic_account.rule']
|
||||
|
||||
+ def _get_fields_readonly(self, name=None):
|
||||
+ return False
|
||||
+
|
||||
@classmethod
|
||||
def get_origin(cls):
|
||||
Model = Pool().get('ir.model')
|
||||
Index: 6.0/trytond/trytond/modules/analytic_invoice/invoice.py
|
||||
===================================================================
|
||||
--- 6.0.orig/trytond/trytond/modules/analytic_invoice/invoice.py
|
||||
+++ 6.0/trytond/trytond/modules/analytic_invoice/invoice.py
|
||||
@@ -61,6 +61,17 @@ class InvoiceLine(AnalyticMixin, metacla
|
||||
class AnalyticAccountEntry(metaclass=PoolMeta):
|
||||
__name__ = 'analytic.account.entry'
|
||||
|
||||
+ def _get_fields_readonly(self, name=None):
|
||||
+ res = super()._get_fields_readonly(name)
|
||||
+ InvoiceLine = Pool().get('account.invoice.line')
|
||||
+ if isinstance(self.origin, InvoiceLine):
|
||||
+ if (self.origin and self.origin.invoice
|
||||
+ and self.origin.invoice.state == 'draft'):
|
||||
+ return False
|
||||
+ else:
|
||||
+ return True
|
||||
+ return res
|
||||
+
|
||||
@classmethod
|
||||
def _get_origin(cls):
|
||||
pool = Pool()
|
||||
Index: 6.0/trytond/trytond/modules/analytic_purchase/purchase.py
|
||||
===================================================================
|
||||
--- 6.0.orig/trytond/trytond/modules/analytic_purchase/purchase.py
|
||||
+++ 6.0/trytond/trytond/modules/analytic_purchase/purchase.py
|
||||
@@ -64,3 +64,14 @@ class AnalyticAccountEntry(metaclass=Poo
|
||||
(('origin.purchase.' + clause[0],) + tuple(clause[1:3])
|
||||
+ ('purchase.line',) + tuple(clause[3:])),
|
||||
]
|
||||
+
|
||||
+ def _get_fields_readonly(self, name=None):
|
||||
+ res = super()._get_fields_readonly(name)
|
||||
+ PurchaseLine = Pool().get('purchase.line')
|
||||
+ if isinstance(self.origin, PurchaseLine):
|
||||
+ if (self.origin and self.origin.purchase
|
||||
+ and self.origin.purchase.state == 'draft'):
|
||||
+ return False
|
||||
+ else:
|
||||
+ return True
|
||||
+ return res
|
||||
\ No newline at end of file
|
||||
Index: 6.0/trytond/trytond/modules/analytic_sale/sale.py
|
||||
===================================================================
|
||||
--- 6.0.orig/trytond/trytond/modules/analytic_sale/sale.py
|
||||
+++ 6.0/trytond/trytond/modules/analytic_sale/sale.py
|
||||
@@ -64,3 +64,14 @@ class AnalyticAccountEntry(metaclass=Poo
|
||||
(('origin.sale.' + clause[0],) + tuple(clause[1:3])
|
||||
+ ('sale.line',) + tuple(clause[3:])),
|
||||
]
|
||||
+
|
||||
+ def _get_fields_readonly(self, name=None):
|
||||
+ res = super()._get_fields_readonly(name)
|
||||
+ SaleLine = Pool().get('sale.line')
|
||||
+ if isinstance(self.origin, SaleLine):
|
||||
+ if (self.origin and self.origin.sale
|
||||
+ and self.origin.sale.state == 'draft'):
|
||||
+ return False
|
||||
+ else:
|
||||
+ return True
|
||||
+ return res
|
||||
\ No newline at end of file
|
1
series
1
series
|
@ -58,3 +58,4 @@ statement_of_account_2.diff # [account] Use from_date and to_date from context i
|
|||
|
||||
issue11306.diff # [analytic_invocie] Add compatibility between the analytic_invocie module and the account_invoice_defer module (only 6.0)
|
||||
issue11359.diff # [product_price_list_dates] add date in pattern to match price list
|
||||
issue11294.diff # [analytic_account, analytic_invoice, analytic_sale, analytic_purchase]
|
||||
|
|
Loading…
Reference in New Issue