add filter for user in income daily report

This commit is contained in:
Camilo Sarmiento 2020-07-07 09:18:55 -05:00
parent 08572c66e8
commit d31579970c
2 changed files with 15 additions and 5 deletions

16
sale.py
View file

@ -1378,7 +1378,7 @@ class SaleIncomeDailyStart(ModelView):
company = fields.Many2One('company.company', 'Company', required=True)
date = fields.Date('Date', required=True)
shop = fields.Many2One('sale.shop', 'Shop')
# user = fields.Many2One('res.user', 'User', required=True)
user = fields.Many2One('res.user', 'User')
# journal = fields.Many2One('account.statement.journal', 'Journal')
@staticmethod
@ -1389,6 +1389,10 @@ class SaleIncomeDailyStart(ModelView):
def default_shop():
return Transaction().context.get('shop')
@staticmethod
def default_user():
return Transaction().user
@staticmethod
def default_date():
Date = Pool().get('ir.date')
@ -1406,13 +1410,15 @@ class SaleIncomeDaily(Wizard):
print_ = StateReport('sale_pos.sale_income_daily_report')
def do_print_(self, action):
shop_id = None
shop_id, user_id = None, None
if self.start.user:
user_id = self.start.user.id
if self.start.shop:
shop_id = self.start.shop.id
report_context = {
'company': self.start.company.id,
'date': self.start.date,
# 'user': self.start.user.id,
'user': user_id,
'shop': shop_id,
}
return action, report_context
@ -1511,6 +1517,10 @@ class SaleIncomeDailyReport(Report):
('move', '!=', None),
('move.post_date', '=', data['date']),
]
if data['user']:
dom_vouchers.append(
('create_uid', '=', data['user']),
)
# if voucher_ids:
# dom_vouchers.append(
# ('id', 'not in', voucher_ids)

View file

@ -8,6 +8,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="date"/>
<label name="shop"/>
<field name="shop" widget="selection"/>
<!-- <label name="user"/>
<field name="user" widget="selection"/> -->
<label name="user"/>
<field name="user" widget="selection"/>
</form>