minor fix add field party in report moves account for sale
This commit is contained in:
parent
fe28013443
commit
fd42a9aac6
41
account.py
41
account.py
|
@ -14,6 +14,7 @@ class SaleAccountMovesStart(ModelView):
|
|||
start_date = fields.Date('Start Date', required=True)
|
||||
end_date = fields.Date('End Date', required=True)
|
||||
shop = fields.Many2One('sale.shop', 'Shop', required=True)
|
||||
party = fields.Many2One('party.party', 'Party')
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
|
@ -35,7 +36,8 @@ class SaleAccountMoves(Wizard):
|
|||
'company': self.start.company.id,
|
||||
'start_date': self.start.start_date,
|
||||
'end_date': self.start.end_date,
|
||||
'shop': self.start.shop.id
|
||||
'shop': self.start.shop.id,
|
||||
'party': self.start.party.id
|
||||
}
|
||||
return action, data
|
||||
|
||||
|
@ -70,26 +72,37 @@ class SaleAccountMovesReport(Report):
|
|||
company = Company(data['company'])
|
||||
shop = Shop(data['shop'])
|
||||
|
||||
statements = Statement.search([
|
||||
('sale_device.shop', '=', shop.id),
|
||||
dom_st = [
|
||||
('sale_device.shop', '=', data['shop']),
|
||||
('date', '>=', data['start_date']),
|
||||
('date', '<=', data['end_date']),
|
||||
])
|
||||
|
||||
_records = []
|
||||
rec_extend = _records.extend
|
||||
for st in statements:
|
||||
for line in st.lines:
|
||||
if line.move:
|
||||
rec_extend(line.move.lines)
|
||||
|
||||
invoices = Invoice.search([
|
||||
]
|
||||
dom_invoice = [
|
||||
('shop', '=', data['shop']),
|
||||
('invoice_date', '>=', data['start_date']),
|
||||
('invoice_date', '<=', data['end_date']),
|
||||
('move', '!=', None),
|
||||
('type', '=', 'out'),
|
||||
])
|
||||
]
|
||||
if data.get('party'):
|
||||
dom_invoice.append(('party', '=', data['party']))
|
||||
|
||||
statements = Statement.search(dom_st)
|
||||
|
||||
_records = []
|
||||
rec_extend = _records.extend
|
||||
if data.get('party'):
|
||||
for st in statements:
|
||||
for line in st.lines:
|
||||
if line.move and line.party.id == data['party']:
|
||||
rec_extend(line.move.lines)
|
||||
else:
|
||||
for st in statements:
|
||||
for line in st.lines:
|
||||
if line.move:
|
||||
rec_extend(line.move.lines)
|
||||
|
||||
invoices = Invoice.search(dom_invoice)
|
||||
for inv in invoices:
|
||||
rec_extend(inv.move.lines)
|
||||
|
||||
|
|
|
@ -10,4 +10,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue