diff --git a/app/commons/model.py b/app/commons/model.py index 63e4e6a..5c95ac0 100644 --- a/app/commons/model.py +++ b/app/commons/model.py @@ -166,17 +166,7 @@ class TableModel(QAbstractTableModel): if field.get('digits'): digits = 0 target_field = field.get('digits')[0] - target = None - try: - if index_row.get(target_field): - target = index_row[target_field] - elif '.' in target_field: - split_ = target_field.split('.') - target = index_row[split_[0]][split_[1]] - except: - pass - # if index_row.get(target_field): - # target = index_row[target_field] + target = index_row['unit.']['symbol'] if target: group_digits = field.get('digits')[1] if group_digits.get(target): diff --git a/app/constants.py b/app/constants.py index 0c6d462..d2e105b 100644 --- a/app/constants.py +++ b/app/constants.py @@ -47,6 +47,7 @@ CONVERSION_DIGITS = { 'u': '0', 'g': '4', 'm': '2', + 'dm': '2', 'km': '2', 'kg': '2', } diff --git a/app/dialogs.py b/app/dialogs.py index 115ff9f..3681b7f 100644 --- a/app/dialogs.py +++ b/app/dialogs.py @@ -1370,9 +1370,9 @@ class ProductEdit(QuickDialog): def set_line(self, record): self.active_line = record self.show() - name = record.get('product.template.name', None) - if not name: - name = record['product.']['template.']['name'] + # name = record.get('product.template.name', None) + # if not name: + name = record['product.']['name'] self.label_product.setText(name) if hasattr(self, 'field_description'): self.field_description.setText(record['description']) @@ -1395,7 +1395,7 @@ class ProductEdit(QuickDialog): value = self.field_combobox_fraction.get_label() self.store['quantity'] = qty price_ = self.parent.get_product_fraction_prices( - self.active_line['product']['id'], + self.active_line['product.']['id'], self.active_line['sale'], qty ) diff --git a/app/main.py b/app/main.py index cda5574..c80abe9 100644 --- a/app/main.py +++ b/app/main.py @@ -54,7 +54,7 @@ _SALE_HISTORIC = [ 'party.name', 'sale_date', 'number', 'invoice_number', 'consumer.name', 'total_amount_cache', 'lines.quantity', 'lines.product.name', 'lines.unit.symbol', 'lines.amount', 'lines.unit_price_w_tax', 'lines.amount_w_tax', - 'lines.product.template.name', 'lines.note' + 'lines.note' ] @@ -842,14 +842,7 @@ class AppWindow(FrontWindow): rec = {} try: quantity = Decimal(eval_value) - try: - product_id = self._sale_line['product.']['id'] - except Exception as e: - print(e) - try: - product_id = self._sale_line['product']['id'] - except: - product_id = self._sale_line['product'] + product_id = self._sale_line['product.']['id'] if product_id and self.stock_context: _product, = self.Product.find( [('id', '=', product_id)], @@ -1612,12 +1605,6 @@ class AppWindow(FrontWindow): 'records': [sale_id], } result = report.get(values) - # result = { - # 'oext': oext, - # 'content': content, - # 'direct_print': direct_print, - # 'name': file_name, - # } report.open(result) elif type_doc == 'invoice': if not sale.get('invoices'): @@ -1642,12 +1629,6 @@ class AppWindow(FrontWindow): 'records': [invoice_id], } result = report.get(values) - # result = { - # 'oext': oext, - # 'content': content, - # 'direct_print': direct_print, - # 'name': file_name, - # } report.open(result) def action_comment(self): @@ -1678,18 +1659,10 @@ class AppWindow(FrontWindow): 'agent': self.field_agent_id, # 'commission': int(commission), }) - # agent, = self.Agent.find([ - # ('id', '=', self.field_agent_id), - # ]) - # if commission <= agent['plan.']['percentage']: - # else: - # self.message_bar.set('invalid_commission') - # return self.message_bar.set('system_ready') comm_string = str('[' + str(commission) + ']' + ' ') + (str(self.field_agent_ask.text())) self.field_agent.setText(comm_string) - # self._set_commission_amount(sale['untaxed_amount'], commission) def _set_commission_amount(self, untaxed_amount, commission): untaxed_amount = int(untaxed_amount) @@ -2771,8 +2744,6 @@ class AppWindow(FrontWindow): product = self._search_product(code) if product: product_id = product['id'] - elif product: - product_id = product['id'] if not product_id: self._state = 'warning' @@ -2823,13 +2794,13 @@ class AppWindow(FrontWindow): return True def add_sale_line(self, record): - if not record.get('unit.symbol'): - record['unit.symbol'] = record['unit.']['symbol'] - if isinstance(record.get('product.'), dict): - if not record.get('product.template.name'): - record['product.template.name'] = record['product.']['template.']['name'] - if not record.get('product.code'): - record['product.code'] = record['product.']['code'] + # if not record.get('unit.symbol'): + # record['unit.symbol'] = record['unit.']['symbol'] + # if isinstance(record.get('product.'), dict): + # if not record.get('product.name'): + # record['product.name'] = record['product.']['name'] + # if not record.get('product.code'): + # record['product.code'] = record['product.']['code'] if record.get('order_sended'): record['order_sended'] = '✔' rec = self.model_sale_lines.add_record(record) @@ -2888,7 +2859,7 @@ class AppWindow(FrontWindow): 'width': 80 } product = { - 'name': 'product.template.name', + 'name': 'product.name', 'align': alignLeft, 'description': 'NOMBRE', 'width': STRETCH @@ -3201,9 +3172,7 @@ class AppWindow(FrontWindow): self.label_input.setFocus() self.dialog_product_edit.close() if self.enviroment == 'restaurant': - prd_code = removed_item.get('product.code', None) - if isinstance(removed_item.get('product.'), dict): - prd_code = removed_item['product.']['code'] + prd_code = removed_item['product.']['code'] if prd_code and self._config['tip_product.']['code'] == prd_code: self.Sale.write([self._sale['id']], {'tip': None}) diff --git a/app/models.py b/app/models.py index 0acc107..2f568ce 100644 --- a/app/models.py +++ b/app/models.py @@ -46,7 +46,7 @@ MODELS_RESTAURANT = { 'product.template.sale_price_w_tax', 'type', 'quantity', 'unit_price_w_tax', 'product.description', 'note', 'description', 'qty_fraction', 'amount_w_tax', 'unit.symbol', - 'product.template.name', 'product.code', 'unit.digits', 'amount', + 'product.name', 'product.code', 'unit.digits', 'amount', 'discount_rate', 'product.sale_price_w_tax', 'product.quantity', 'order_sended', 'product.sale_price_taxed', 'sale' ] @@ -263,7 +263,7 @@ MODELS_RETAIL = { 'product.template.sale_price_w_tax', 'type', 'quantity', 'unit_price_w_tax', 'product.description', 'note', 'description', 'qty_fraction', 'amount_w_tax', 'unit.symbol', - 'product.template.name', 'product.code', 'unit.digits', 'amount', + 'product.name', 'product.code', 'unit.digits', 'amount', 'discount_rate', 'product.sale_price_w_tax', 'product.quantity', 'order_sended', 'product.sale_price_taxed', 'sale' ] diff --git a/app/version.py b/app/version.py index 4f90a35..045fe8d 100644 --- a/app/version.py +++ b/app/version.py @@ -1 +1 @@ -__version__ = "6.0.16" +__version__ = "6.0.17"