diff --git a/opportunity.py b/opportunity.py index 4a070d3..0c2f87a 100644 --- a/opportunity.py +++ b/opportunity.py @@ -48,7 +48,6 @@ class Opportunity( ['cancelled']), } _depends_stop = ['state'] - number = fields.Char('Number', readonly=True, required=True) party_contact = fields.Char('Party Contact', states=_states_opp) reference = fields.Char('Reference', states=_states_opp) @@ -738,6 +737,14 @@ class CrmOpportunityFollowUp(sequence_ordered(), ModelSQL, ModelView): action = fields.Char('Action') notes = fields.Text('Notes') done_by = fields.Many2One('res.user', 'Done By') + state = fields.Selection([ + ('draft', "Draft"), + ('done', "Done"), + ], "State", required=False, readonly=True) + + @staticmethod + def default_state(): + return 'draft' class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView): @@ -745,8 +752,14 @@ class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView): __name__ = "crm.opportunity.line" _history = True _states = { - 'readonly': Eval('opportunity_state').in_( - ['quote_revision', 'quote_approbation', 'customer_approbation', 'review', 'accepted', 'lost', 'cancelled']), + 'readonly': Eval('opportunity_state').in_([ + 'quote_revision', + 'quote_approbation', + 'customer_approbation', + 'review', + 'accepted', + 'lost', + 'cancelled']), } _depends = ['opportunity_state'] @@ -781,11 +794,13 @@ class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView): tax = fields.Function(fields.Float('Tax Line'), 'get_tax_line') total_line = fields.Function(fields.Integer('Total Line'), 'get_total_line') base_tax = fields.Function(fields.Float('Base Tax'), 'get_base_tax') - description = fields.Function(fields.Text('Description'), - 'on_change_with_description') + description = fields.Text('Description') unit_price = fields.Numeric('Unit Price', digits=(16, 2)) + start_invoice_date = fields.Date('Start Invoice Date') total_line_with_tax = fields.Function(fields.Integer('Total Line'), 'get_total_line_with_tax') + payment_term = fields.Many2One('account.invoice.payment_term', + 'Payment Term') del _states, _depends @@ -848,19 +863,14 @@ class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView): if self.product: return self.product.list_price - @fields.depends('product') - def on_change_with_description(self, name=None): - if self.product: - return self.product.description - - # Product = Pool().get('product.product') - # sale_line = SaleLine( - # type='line', - # product=self.product, - # sale=sale, - # description=None, - # ) - # return sale_line + # Product = Pool().get('product.product') + # sale_line = SaleLine( + # type='line', + # product=self.product, + # sale=sale, + # description=None, + # ) + # return sale_line @fields.depends('product', 'unit') diff --git a/view/opportunity_follow_up_form.xml b/view/opportunity_follow_up_form.xml index 515723c..3f24246 100644 --- a/view/opportunity_follow_up_form.xml +++ b/view/opportunity_follow_up_form.xml @@ -8,6 +8,8 @@ this repository contains the full copyright notices and license terms. -->