Remove use useless method get_salesman

This commit is contained in:
Oscar Alvarez 2020-04-21 19:26:19 -05:00
parent 62b99dd9b1
commit 9289958dc7
4 changed files with 11 additions and 21 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ yarn-error.log*
package-lock*
/__pycache__
/app/__pycache__

View File

@ -4,7 +4,7 @@ Installing Tryton POS Client
Prerequisites Client
--------------------
* Python 3.5 or later (http://www.python.org/)
* Python 3.6 or later (http://www.python.org/)
* python-setuptools
* python3-pyqt5
* python3-pyqt5.qtsvg

View File

@ -54,7 +54,6 @@ class MainWindow(FrontWindow):
self.ctx = self._context
self.ctx['params'] = params
# self.ctx['params'] = params
response = self.load_modules()
if response is not True:
d = self.dialog(response)
@ -874,7 +873,7 @@ class MainWindow(FrontWindow):
self._done_sale()
return True
self.field_journal_id = self._default_journal_id
self.field_journal_id = self.default_journal['id']
if res['msg'] == 'missing_money':
self.message_bar.set('enter_payment', self.default_journal['name'])
@ -1066,7 +1065,6 @@ class MainWindow(FrontWindow):
def validate_payment_term(self):
is_credit = self._payment_terms[str(self.field_payment_term_id)]['is_credit']
party = self.Party.find([('id', '=', self.party_id)])[0]
if is_credit:
if self.party_id == self.default_party['id']:
self.dialog('customer_not_credit')
@ -1399,12 +1397,10 @@ class MainWindow(FrontWindow):
def on_selected_party(self):
party_id = self.dialog_search_parties.get_id()
party, = self.Party.find([
('id', '=', party_id)
])
if not party_id:
return
party, = self.Party.find([('id', '=', party_id)])
values = {
'party': party_id,
'invoice_address': party['addresses'][0]['id'],
@ -1425,13 +1421,10 @@ class MainWindow(FrontWindow):
self.party_id = party_id
self.field_party.setText(party['name'])
res = self.ModSale.get_salesman_in_party({
'party_id': party_id,
})
if res:
self.field_salesman_id = res['id']
if party.get('salesman'):
self.field_salesman_id = party['salesman']['id']
self._PosSale.write([self._sale['id']], {'salesman': self.field_salesman_id})
self.field_salesman.setText(res['name'])
self.field_salesman.setText(party['salesman']['name'])
# if self._credit_limit_activated:
# self._check_credit_capacity(party)
@ -2200,7 +2193,7 @@ class MainWindow(FrontWindow):
'ids': [self._sale_line['product']['id']],
'quantity': float(qty),
'sale_id': self._sale['id'],
})
})
if price_ and price_.get('unit_price_w_tax'):
price_list = str(price_['unit_price_w_tax'])
self.row_field_price.setText(price_list)

View File

@ -19,14 +19,11 @@ def encoder(obj):
class FastModel(object):
def __init__(self, model, ctx):
# params = parent.params
# self.model = model['name']
self.model = model
# self.fields = model['fields']
self.ctx = ctx
self.api = '/'.join(
['http:/', ctx['params']['api_url'], ctx['params']['database']]
)
api_url = ctx['params']['api_url']
db = ctx['params']['database']
self.api = '/'.join(['http:/', api_url, db])
def __getattr__(self, name, *args):
'Return attribute value'
@ -46,7 +43,6 @@ class FastModel(object):
}
data = json.dumps(args_, default=encoder)
res = requests.get(route, data=data)
print('res ', res)
return res.json()
def write(self, ids, values):