minor fix

This commit is contained in:
wilson gomez 2021-07-13 15:33:45 -05:00
parent fbc16c8b25
commit a64cbc5cc3
6 changed files with 30 additions and 18 deletions

View File

@ -18,6 +18,7 @@ _ZERO = Decimal('0.00')
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
annexes = fields.Many2Many('account.invoice-laboratory.order', 'invoice', 'order', 'annexes')
operation_center = fields.Many2One('company.operation_center', 'Operation Center')
class InvoiceLine(metaclass=PoolMeta):

View File

@ -11,6 +11,7 @@ STATES = {
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
operation_center = fields.Many2One('company.operation_center', 'Operation Center')
# patient_payment = fields.Numeric('Patient Payment', states=STATES)
@classmethod

View File

@ -79,6 +79,8 @@ class Order(Workflow, ModelSQL, ModelView):
depends=['state'])
invoice = fields.Many2One('account.invoice', 'Invoice', states=STATES,
depends=['state'])
operation_center = fields.Many2One('company.operation_center', 'Operation Center',
states=STATES, depends=['state'])
@classmethod
def __setup__(cls):
@ -173,20 +175,20 @@ class Order(Workflow, ModelSQL, ModelView):
raise UserError('delete_numbered')
super(Order, cls).delete(records)
def get_status_invoice(self, name):
if self.co_pay and self.co_pay > 0:
if not self.co_pay_invoice and not self.invoice:
status_invoice = 'without_invoice'
elif not self.co_pay_invoice or not self.invoice:
status_invoice = 'partial_invoice'
else:
status_invoice = 'invoiced'
else:
if not self.invoice:
status_invoice = 'without_invoice'
else:
status_invoice = 'invoiced'
return status_invoice
# def get_status_invoice(self, name):
# if self.co_pay and self.co_pay > 0:
# if not self.co_pay_invoice and not self.invoice:
# status_invoice = 'without_invoice'
# elif not self.co_pay_invoice or not self.invoice:
# status_invoice = 'partial_invoice'
# else:
# status_invoice = 'invoiced'
# else:
# if not self.invoice:
# status_invoice = 'without_invoice'
# else:
# status_invoice = 'invoiced'
# return status_invoice
def process_order(self, sale):
pool = Pool()
@ -200,6 +202,7 @@ class Order(Workflow, ModelSQL, ModelView):
if sale.invoices:
invoice = sale.invoices[0]
invoice.invoice_date = self.end_date
invoice.operation_center = self.operation_center
invoice.save()
Invoice.validate_invoice([invoice])
if invoice.type == 'out' and invoice.invoice_type not in ['', None, 'C', 'P', 'M']:
@ -265,8 +268,8 @@ class Order(Workflow, ModelSQL, ModelView):
'reference': self.number,
'invoice_party': invoice_party,
'invoice_type': 'P',
'currency': 31, #FIXME
# 'patient_payment': self.patient_payment,
'currency': 31, # FIXME
'operation_center': self.operation_center.id,
'party': party,
'sale_date': self.order_date,
'state': 'draft',

View File

@ -5,6 +5,7 @@ depends:
company
product
sale
company_operation
xml:
laboratory.xml
configuration.xml

View File

@ -10,5 +10,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="annexes" colspan="4"/>
</page>
</xpath>
<xpath
expr="/form/notebook/page[@id='info']/field[@name='account']"
position="after">
<label name="operation_center"/>
<field name="operation_center"/>
</xpath>
</data>

View File

@ -3,7 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='shipment_address']" position="after">
<!-- <label name="patient_payment"/>
<field name="patient_payment"/> -->
<label name="operation_center"/>
<field name="operation_center"/>
</xpath>
</data>