Set shipment/invoice method as configuration option
This commit is contained in:
1 parent
3b85cac711
commit
b4e3884030
3 files changed
+20
-2
No files matched your search
+8
-1
@@ -1,7 +1,7 @@
|
||||
#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 ModelView, ModelSQL, ModelSingleton, fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, Bool
|
||||
|
||||
|
||||
class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
@@ -14,5 +14,12 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
('company', 'in', [Eval('company'), False]),
|
||||
('code', '=', 'purchase.purchase'),
|
||||
], required=True))
|
||||
purchase_invoice_method = fields.Property(fields.Selection([
|
||||
('manual', 'Manual'),
|
||||
('order', 'Based On Order'),
|
||||
('shipment', 'Based On Shipment'),
|
||||
], 'Invoice Method', states={
|
||||
'required': Bool(Eval('company')),
|
||||
}))
|
||||
|
||||
Configuration()
|
||||
@@ -11,6 +11,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Purchase Configuration">
|
||||
<label name="purchase_sequence"/>
|
||||
<field name="purchase_sequence"/>
|
||||
<label name="purchase_invoice_method" />
|
||||
<field name="purchase_invoice_method" />
|
||||
</form>
|
||||
]]>
|
||||
</field>
|
||||
@@ -36,5 +38,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
search="[('model.model', '=', 'purchase.configuration'), ('name', '=', 'purchase_sequence')]"/>
|
||||
<field name="value" eval="'ir.sequence,' + str(ref('sequence_purchase'))"/>
|
||||
</record>
|
||||
<record model="ir.property"
|
||||
id="property_purchase_invoice_method">
|
||||
<field name="name">purchase_invoice_method</field>
|
||||
<field name="field"
|
||||
search="[('model.model', '=', 'purchase.configuration'), ('name', '=', 'purchase_invoice_method')]" />
|
||||
<field name="value">,order</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
+3
-1
@@ -187,7 +187,9 @@ class Purchase(ModelWorkflow, ModelSQL, ModelView):
|
||||
return 2
|
||||
|
||||
def default_invoice_method(self):
|
||||
return 'order'
|
||||
configuration_obj = self.pool.get('purchase.configuration')
|
||||
configuration = configuration_obj.browse(1)
|
||||
return configuration.purchase_invoice_method
|
||||
|
||||
def default_invoice_state(self):
|
||||
return 'none'
|
||||
|
||||
Reference in new issue
Block a user