Minor fixes

This commit is contained in:
oscar alvarez 2023-07-10 17:12:03 -05:00
parent 93f0b6ed61
commit 77910144c4
6 changed files with 38 additions and 18 deletions

View File

@ -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')

View File

@ -8,6 +8,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="action"/>
<label name="done_by"/>
<field name="done_by"/>
<label name="state"/>
<field name="state"/>
<separator name="notes" colspan="4"/>
<field name="notes" colspan="4"/>
</form>

View File

@ -5,4 +5,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="follow_date" expand="1"/>
<field name="action" expand="1"/>
<field name="done_by" expand="1"/>
<field name="state" expand="1"/>
</tree>

View File

@ -16,6 +16,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="unit_price"/>
<label name="billing_frecuency"/>
<field name="billing_frecuency"/>
<label name="payment_term"/>
<field name="payment_term"/>
<label name="start_invoice_date"/>
<field name="start_invoice_date"/>
<!-- <separator string="Description" colspan="4"/> -->
<field name="description" colspan="4"/>
</form>

View File

@ -8,4 +8,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="unit"/>
<field name="billing_frecuency" expand="1"/>
<field name="start_invoice_date" expand="1"/>
<field name="payment_term" expand="1"/>
</tree>

View File

@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="reference" expand="1"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="party_contact" expand="1"/>
<field name="agent" expand="1"/>
<field name="description" expand="1"/>
<field name="party" expand="1"/>